0
Why my animation doesn't move left.
https://code.sololearn.com/WZ1XQhf5Ilqz/#html my animation successfully moves to right and bottom, but even with the right code it fails to move to the left. Can you point out the issue?
11 Réponses
+ 3
Changed some logics😊....
https://code.sololearn.com/WBne2K5tfbkU/?ref=app
+ 5
Kshitij Shukla you could use right also, but here you have a value of left property, that's why I kept using left
+ 5
Kshitij Shukla no probs i made an example of this being used
https://code.sololearn.com/WFIuYeU8jy7Z/?ref=app
+ 5
Kshitij Shukla hey, i made this yesterday but forgot post it its just an example of this type of animation without having to use intervals
https://code.sololearn.com/W4tL753XEXKN/?ref=app
+ 3
the best way to change directions is to convert a positive increment to a negative you shouldent really need to set Intervals for this type of animation as you can control the animation speed using smaller incremnets;
var inc = 1;
var x = 5;
if(x==20|| x==0){inc=-inc}
x+=inc;
this will change the direction of the xaxis once conditions are met making x += -1
+ 2
excellent work and thank you for the help.
I've just one question. while moving to right we increased pixels on left, while moving down we increased pixels on top, then why doesn't it work when we try to increase pixels on right?
decreasing pixels on left instead was smart.
+ 1
with your help was able to complete one tour.
https://code.sololearn.com/W3eztUkLVggk/?ref=app
+ 1
also i wanted to know if there was any other way this could have been made? I used setTimeout. anything other than that?
+ 1
D_Stark let me try what your are suggesting, i don't understand it by reading, so I'll put it into code and try it. thank you for replying
+ 1
D_Stark Md. Nafis Ul Haque Shifat
https://code.sololearn.com/W3eztUkLVggk/?ref=app
i wanted the box to keep moving in squares say for 5 times? how do i do that?
i tried the for loop and while loop, won't work. any ideas?
0
i loved this animation, there are some aspects of the code i don't understand yet, but it's really good