Skip to content

Feature: improved animations #47

Description

@sc0ttj

Make it easier to manage animations during playback:

  1. Expose the functionality of both tweenState and springTo which let you pause, resume or stop animations, during playback. Both add-ons have this functionality hidden away - expose it, and update the docs.

  2. Add a direction prop to tweenState and springTo configs, based on CSS direction property

  3. Add a stopAt prop, to say where the anim should skip to when stopped (current, start or end).

  4. Add repeat and repeatDelay props, to apply staggered anims to a collection of elems/items.

Example usage:

Foo.setState({ x: 0 });

const myAnim = Foo.tweenState(
  // the props to tween
  { x: 99 }, 
  // the tween settings
  { 
     paused: true, // don't auto play
     duration: 4000,
     direction: 'alternate', // which direction to animate.. can be 'forward', 'backward', 'alternate' 
     stopAt: 'end', // where to go when stop() is called during playback.. can be 'current', 'end' or 'start'
     repeat: 3, // loop 3 times
     repeatDelay: 1000, // pause for 1 second between each loop 
  }
);

myAnim.play() // start the tween

myAnim.pause() // pause the tween

myAnim.resume() // continue the tween

myAnim.stop() // stop the tween, (and go back to frame 1 or end, see `stopAt` prop)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions