setInterval repeat 3 time and kill #716
Replies: 6 comments
-
Posted at 2017-04-20 by Mrbbp I answer that i've understood. Regards |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-20 by @gfwilliams You'll need to use either a global variable, or a closure. In your example, simply doing:
will work. As I think you figured out, in |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-20 by Mrbbp Sorry @gordon i do not understand the difference between the 2 versions.. what do you mean by callback? is it the function define in the setInterval? I've tried reinitiate a setInterval at the end of 8 "danse"move but does not works... i've got an unknown interval error!
sorry for my ugly code |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-20 by @gfwilliams The difference is that you are not passing the In it's simplest form, not this:
but this:
I'm not quite sure what you're trying to do, but try starting with the code above and then modifying it to do what you want. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-20 by Mrbbp ok i've understood. regards éric |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-04-20 by @gfwilliams If you want to reference different intervals at the same time, that can be pretty easy as well:
I only suggest the closures because it looked like you wanted to start several copies of the same interval, which would stop themselves |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-04-19 by Mrbbp
Hello,
well, i'm a bit loose with setInterval et clearInterval...
I need to repeat 3 time a function with a time of 200ms
I've tried this
in the console it said
i've tried to use the id and it "works" (it stop)
and it stops after 3 time.
i've tried the same in a function in a setInterval and it stops all the setInterval
where i'm wrong?
is there a way to pass the id to function?
or is there a simple way to repeat a definite time a function?
i want to animate text letter by letter
regards
éric
Beta Was this translation helpful? Give feedback.
All reactions