just-animate
Version:
_Making Animation Simple_
19 lines (18 loc) • 527 B
JavaScript
import { loopOff } from '../core/timeloop';
import { S_PAUSED, _ } from '../utils/constants';
import { destroy } from './destroy';
import { update } from './update';
import { FINISH } from '../actions';
export const finish = (model, _data, ctx) => {
model.round = 0;
model.state = S_PAUSED;
if (!model.yoyo) {
model.time = model.rate < 0 ? 0 : model.duration;
}
loopOff(model.id);
update(model, _, ctx);
ctx.trigger(FINISH);
if (model.destroy) {
destroy(model, _, ctx);
}
};