+ 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 :(

1st Apr 2017, 4:52 PM
Gami
Gami - avatar
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.
1st Apr 2017, 5:25 PM
Ashwani Kumar
Ashwani Kumar - avatar
+ 14
Now I am gonna hide the code, because I still have to work on it :)
1st Apr 2017, 6:16 PM
Gami
Gami - avatar
+ 13
I see now!!! Thank you really much... I am so silly... :( Thxxxx :D
1st Apr 2017, 6:13 PM
Gami
Gami - avatar
+ 12
@Ashwani I can fix that error... My question is why doesn't it clear the canvas the second time
1st Apr 2017, 5:46 PM
Gami
Gami - avatar
+ 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.
1st Apr 2017, 5:58 PM
Ashwani Kumar
Ashwani Kumar - avatar
+ 7
@Gami No problem. Happens every now and then with programmers 😀
1st Apr 2017, 7:09 PM
Ashwani Kumar
Ashwani Kumar - avatar