I’m currently working on the a cliche Javascript particle system. However, I’m working to a canvas with an area set to that of the users window.
Despite the size of the canvas, the value of the width and height are returned as 0, which very much becomes and issue when I’m trying to draw to random positions within the canvas.
particle {particle_x: 0, particle_y: 0, particle_size: 2, particle_color: "rgb(211,121,11);"}
particle {particle_x: 0, particle_y: 0, particle_size: 6, particle_color: "rgb(51,108,134);"}
particle {particle_x: 0, particle_y: 0, particle_size: 6, particle_color: "rgb(193,165,42);"}
particle {particle_x: 0, particle_y: 0, particle_size: 5, particle_color: "rgb(231,26,18);"}
Here’s the code on codepen (You will need to edit and check the console to see the debugging)
http://codepen.io/Responsive/pen/bNxzGJ
So is there anyway, I can maintain the 100% area, but have the width and height return a value in pixels?
Thanks for any help!