Animate properties using requestAnimationFrame and a custom render function
$ npm install @f/animate
varanimate=require('@f/animate')varapplyStyles=require('@f/apply-styles')animate({width: 10},{width: 100},props=>applyStyles(element,props))start- The initial value of the properties you want to animateend- The final value of the properties you want to animaterender- A function that receivesrender(props, t)wherepropsis the interpolated properties, andtis the frame number.duration- The duration in milliseconds. Defaults to 350ms.easing- An easing function that accepts a frame number and interpolates it along an easing curve.
Returns: A stop function. Call it if you want to cancel an in-flight animation.
MIT