UNPKG

just-animate

Version:
18 lines (17 loc) 477 B
import { pause } from './pause'; import { play } from './play'; import { S_PAUSED, S_PLAYING, _ } from '../utils/constants'; import { all } from '../utils/lists'; export function rebuild(model, ctx) { const state = model.state; all(model.players, p => p.cancel()); model.players = _; switch (state) { case S_PAUSED: pause(model, _, ctx); break; case S_PLAYING: play(model, _, ctx); break; } }