+ 1
Animation not working
Why is this animation not working? https://code.sololearn.com/W03gCoeVZcs8/?ref=app
6 Answers
+ 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
+ 2
SolomonDavid Akesoba No problem
+ 2
Oh sorryđ... Actually I didn't check the JS part... I thought u would add it in html with the script tag... Sorry
+ 1
Brinjalđ haha. No worries. I'm done with the code anyways.
0
Brinjalđ how? It's a JavaScript animation.
0
Aymane Boukrouh [INACTIVE] thanks.