Can some one tell me how to make the second div slower than the first? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can some one tell me how to make the second div slower than the first?

https://code.sololearn.com/WDmZ8W3td4DO/?ref=app

28th Aug 2020, 6:15 AM
Dani Mecoss
12 Answers
+ 6
Maintain two sperate variables for each animation. https://code.sololearn.com/WwXokwQgx8AI/?ref=app
28th Aug 2020, 6:20 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 4
🔫 Rick Grimes too many flaws 😬🔫 I thought that the variable 'pos' is the rate of change and not the change itself 😆
28th Aug 2020, 7:28 AM
Namit Jain
Namit Jain - avatar
+ 4
Dani Mecoss why all? I didn't help you Instead, I got confused 😌😆😂
28th Aug 2020, 1:38 PM
Namit Jain
Namit Jain - avatar
+ 4
Dani Mecoss 😆😆🙂 You're welcome then 😅
28th Aug 2020, 6:37 PM
Namit Jain
Namit Jain - avatar
+ 3
https://code.sololearn.com/WylRmxi4JfWc/?ref=app It looks the same speed even when you change the time interval because the 'pos' variable increases at the same rate as the more speedier one.
28th Aug 2020, 6:23 AM
Ćheyat
Ćheyat - avatar
+ 3
Just put a smaller value in line 26 Like: pos+=0.5
28th Aug 2020, 6:55 AM
Namit Jain
Namit Jain - avatar
+ 3
🔫 Rick Grimes Ohh 🤔 I didn't know he used a single variable for 2 different animations 😳
28th Aug 2020, 7:00 AM
Namit Jain
Namit Jain - avatar
+ 3
🔫 Rick Grimes what about changing the time interval 🙌 In line just put a value > 10
28th Aug 2020, 7:01 AM
Namit Jain
Namit Jain - avatar
+ 2
Namit, try it as well. If you run the second animation after 500ms and first is running at 10ms then value of pos will still be changing because of animation1.
28th Aug 2020, 7:03 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
Namit Jain try it. He uses one variable for both animation, so value will be same no matter how less you add.
28th Aug 2020, 6:59 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
thx all
28th Aug 2020, 1:36 PM
Dani Mecoss
+ 1
namit cuz u take the time at least to confuse me
28th Aug 2020, 4:07 PM
Dani Mecoss