+ 13
Guys I really need help with this...
Everything almost works fine, but I have two questions... 1. Why does it look like it is flashing? 2. After it finishes drawing the first circles, it clears the canvas, but the next time stops... Why? Can someone explain this to me?? I am not really good in Javascript :(
6 Answers
+ 11
@Gami I see this error in code
Uncaught TypeError: Cannot read property 'x' of undefined
Line: 46
This is because m is the index of points array which is going out of bounds.
I guess, The flashing thing will go off if you are able to resolve m going out of bounds which is 199 in your case i guess.
+ 14
Now I am gonna hide the code, because I still have to work on it :)
+ 13
I see now!!! Thank you really much... I am so silly... :( Thxxxx :D
+ 12
@Ashwani I can fix that error... My question is why doesn't it clear the canvas the second time
+ 9
if (n == 199) {
ctx.beginPath();
ctx.clearRect(0, 0, c.width, c.height);
ctx.closePath();
s++;
n=0; // I have put so that n can reach 199 again //depending upon your requirement you could change this line
}
@Gami n will be 199 just once in the code hence clearRect will work just once.
To enter that if block again you need to reset n or change if condition.
I might be wrong in this, but i find this a probable reason.
+ 7
@Gami No problem. Happens every now and then with programmers đ