var shapes = new Array();
for (var i = 0; i < 250; i++) {
var x = Math.random()*250;
var y = Math.random()*250;
var width = height = Math.random()*5;
var color = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
<p id="demo"> klikni za spremembo </p>
</body>
</html>
10-26-2012, 08:53 PM
ReFreezed
In the Shape constructor function...
this.color = context.fill;
Change it to this:
this.color = color;
And in the for loop in the animate function, add this line:
context.fillStyle = tmpShape.color;
(You don't specify any color in fillRect.)
10-28-2012, 11:32 AM
jumbee
great, thank you a lot...
10-28-2012, 04:44 PM
George88
You'll want to familiarise yourself with the JavaScript console for debugging, as this will be where all your error messages and warnings are displayed. In Internet Explorer (version 9), press F12. For Chrome you can press Ctrl + Shift + C, for Firefox you'll need to download Firebug and once installed, press Crtl + Shift + C. For Opera you'll need to to use Ctrl + Shift + I to open Dragonfly.
For Safari, go to Edit -> Preferences -> Advanced -> "Show develop menu in menu bar". Then go to "Develop" in the menu and start debugging JavaScript.
My advice would be to simply start Googling your errors as and when they occur to give you a more practical understanding of what's happening.