question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reset styles and rerun animation

See original GitHub issue

Hello,

i want rerun an animation, after i removed the extra styles, which added velocityjs. But it is not working. Here is a fiddle fiddle.

var element = document.getElementById('animate');

var animate = function()
{
  Velocity(element, {translateX: 500},  {duration: 2000, queue: false, complete: function(){
		element.removeAttribute('style');
 		animate();
  }});
};

animate()

Have someone any idea, to manage this? Is there a reset function or something?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
stephan-fischercommented, Feb 15, 2017

Hi Rycochet,

i hope you can answer on closed Issued. Exactly what i have fiddled, i need for banner ad development. And in this case is easer to not know the “starting values”. Can the Cache be cleared by a function like “reset” - or “clear cache”? If not maybe its a good new feature.

0reactions
Rycochetcommented, Feb 15, 2017

Damn, it definitely looks like it should work from the source, can confirm that it doesn’t work. There is a hacky way to clear internal data, but I can’t remember what it is (having never used it or looked at the cache code) - instead could you clear the values via Velocity with a duration of 0?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restart CSS Animation
With CSS animations (ala @keyframes) it's not as easy as you might think to “restart” it. Let's say you set it to run...
Read more >
Restart animation in CSS3: any better way than removing the ...
Just set the animation property via JavaScript to "none" and then set a timeout that changes the property to "" , so it...
Read more >
Restarting a CSS Animation - KIRUPA
If you are just looking for the one snippet of code you need to add to make restarting a CSS animation possible, then...
Read more >
Restart a CSS Animation With JavaScript | harrytheo.com
Restarting an animation is not as easy as I originally thought, by just adding and removing classes. Making this work was more tedious...
Read more >
Restart CSS Animations in Email - Email On Acid
The key to restarting a CSS animation is to set the animation-name of an animation to 'none' and then setting it back to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found