microsoft / fluentui-contrib

Monorepo for contributor extension packages to Fluent UI
MIT License
25 stars 27 forks source link

BREAKING: Stopping a fallback animation should be imperative #133

Closed ling1726 closed 3 months ago

ling1726 commented 3 months ago

Ths user will no longer need to provide a stopping condition. The fallback animation now returns its own imperative stop function

Before

const animation = fallbackPaintAnimation({...options, isStopped: ()  => false});
const { id, play, canvas, cleanup } = animation(node);

let stopCondition = false;
const isStopped = () => stopCondition === true;
play(onComplete, isStopped, onUpdate);

const stop = () => stopCondition = true;

// stops the animation
stop();

After

const animation = fallbackPaintAnimation({...options});
const { id, play, stop, canvas, cleanup } = animation(node);

play(onComplete, onUpdate);

// stops the animation
stop();