+ 1

Animation not working

Why is this animation not working? https://code.sololearn.com/W03gCoeVZcs8/?ref=app

16th Jan 2020, 5:29 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar
6 ответов
+ 3
SolomonDavid Akesoba you forgot one little detail. Inside the setInterval function, you are resetting the value of p to 0, then adding 10. So the value of p will always remain 10, thus will never change position. p variable should be defined outside the function, like this: https://code.sololearn.com/WqgNdMKisix1/?ref=app
16th Jan 2020, 5:36 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
16th Jan 2020, 5:43 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
Oh sorry😂... Actually I didn't check the JS part... I thought u would add it in html with the script tag... Sorry
16th Jan 2020, 5:44 PM
ヽ(^。^)ノ✨ヽ(^。^)ノ
ヽ(^。^)ノ✨ヽ(^。^)ノ - avatar
+ 1
Brinjal🍆 haha. No worries. I'm done with the code anyways.
16th Jan 2020, 7:10 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar
0
Brinjal🍆 how? It's a JavaScript animation.
16th Jan 2020, 5:34 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar
16th Jan 2020, 5:43 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar