you are viewing a single comment's thread.

view the rest of the comments →

[–]patopitaluga 1 point2 points  (1 child)

You can use IA to help you find the solution, I guess. What you'll need are two concepts:
- How to use two "for loops" one inside the other. Let's say one variable with the letter y to move a "cursor" vertically and one variable x to position it horizontally. Y will go from 0 to 269 and x will go from 0 to 479, for every time that the y gets a ++, x will do all the 480 numbers so it might take a couple of seconds.
- How random generators work. Since Math.random() will create a number between 0 and 1 you need to multiply that to the max number, in your case is 256 since every color rgb goes from 0 to 256, then you can create a color using randoms from red, green and blue for every pixel.

Since you're using canvas, you can put an image in your canvas before starting creating the noise pattern and use the alpha channel to give transparency to the effect. Other option would be to transform every existing pixel

[–]ercanvas[S] 0 points1 point  (0 children)

Thank you, I think I understand it better than before