Enhancement: Step animations through custom easings
See original GitHub issueHi,
I wanted to animate a background image (sprite sheet) to replace a css3 animation. The current CSS equivalent is:
@keyframes play {
from { background-position: 0px; }
to { background-position: -600px; }
}
.loader {
width: 20px;
height: 20px;
background-image: url("../img/loader.png");
@include animation(play 1s steps(10) infinite);
}
My current implementation with velocity is:
window.setInterval(function() {
$element.velocity({
'background-position-x': ['-600px', '0px']
}, {
duration: 1000
});
}, 1000);
But it animates the background position with a step that I can’t control. I would like to increment it by 20px each frame (the width of the loader), otherwhise it won’t work as expected.
Is this possible with velocity ? Maybe with the easing function ?
Issue Analytics
- State:
- Created 9 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Add easing to custom animation function - Stack Overflow
But what it basically comes down to is that you are changing 'the form' of the easing function by the following properties:.
Read more >The Basics of easing - web.dev
Learn how to soften and give weighting to your animations. ... You can also go completely custom with your easing, which gives you...
Read more >animation-timing-function - CSS: Cascading Style Sheets | MDN
The easing function that corresponds to a given animation, as determined by animation-name . The non-step keyword values (ease, linear, ...
Read more >Incorporating elastic ease in CSS animations - LogRocket Blog
One simple yet fantastic solution is to use cubic-bezier ease to get a single-step elastic. You can do so by giving the fourth...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Turns out the step function is really simple:
thanks, @ocombe! awesome use