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?

28th Sep 2018, 8:54 AM
Kshitij Shukla
Kshitij Shukla - avatar
11 Answers
+ 3
Changed some logics😊.... https://code.sololearn.com/WBne2K5tfbkU/?ref=app
28th Sep 2018, 9:20 AM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 5
Kshitij Shukla you could use right also, but here you have a value of left property, that's why I kept using left
28th Sep 2018, 12:01 PM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 5
Kshitij Shukla no probs i made an example of this being used https://code.sololearn.com/WFIuYeU8jy7Z/?ref=app
28th Sep 2018, 4:02 PM
D_Stark
D_Stark - avatar
+ 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
3rd Oct 2018, 2:10 PM
D_Stark
D_Stark - avatar
+ 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
28th Sep 2018, 12:13 PM
D_Stark
D_Stark - avatar
+ 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.
28th Sep 2018, 11:28 AM
Kshitij Shukla
Kshitij Shukla - avatar
+ 1
with your help was able to complete one tour. https://code.sololearn.com/W3eztUkLVggk/?ref=app
28th Sep 2018, 11:56 AM
Kshitij Shukla
Kshitij Shukla - avatar
+ 1
also i wanted to know if there was any other way this could have been made? I used setTimeout. anything other than that?
28th Sep 2018, 11:56 AM
Kshitij Shukla
Kshitij Shukla - avatar
+ 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
28th Sep 2018, 2:45 PM
Kshitij Shukla
Kshitij Shukla - avatar
+ 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?
3rd Oct 2018, 3:14 AM
Kshitij Shukla
Kshitij Shukla - avatar
0
i loved this animation, there are some aspects of the code i don't understand yet, but it's really good
3rd Oct 2018, 3:12 AM
Kshitij Shukla
Kshitij Shukla - avatar