Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic pattern in javascript

I am curious as to where to start to make something similar to HERE as I cannot find any information about it. It may be fairly simple and im sorry if it is.

What I am hoping to replicate is the colour grid that generates based on the colours and size of the lines. I am looking to replicate the functionality of the application whereby when the user selects a line and changes the width of that line and it will then calculate the image. I have been looking around but cannot find information about how to replicate it. I may be searching for the wrong thing as javascript is not my strongest language.

I know of a roundabout way to do it with svg but where would I start for javascript/jquery?

enter image description here

like image 914
Allreadyhome Avatar asked Jan 28 '26 20:01

Allreadyhome


1 Answers

I know of a way to do it with svg but where would I start for javascript/jquery?

Well, SVG would involve javascript as well, wouldn't it? You're just looking for different ways to display an image. None is native the javascript, that is just a programming language, you'd have to consider which API to use:

  • There's nothing wrong with SVG! It even seems to be the easiest solution, maybe wrapping DOM code in some nice drawing library.
  • It has been demonstrated that such is possible with CSS3 background patterns, although I would consider this rather unusable
  • Use the <canvas> element! This would be the most genuine HTML5 approach, and even though the api is rather simple there exist mighty libraries.
like image 157
Bergi Avatar answered Jan 31 '26 09:01

Bergi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!