import { ITimelineModel , AnimationPlayer } from '../core/types' ; import { plugins } from '../core/plugins' ; import { toEffects } from '../model/effects' ; import { all , push } from '../utils/lists' ; import { TargetConfiguration } from '../core/types' ; import { resolveRefs } from '../core/references' ; import { calculatePlayers } from './calc-players' ; export function setup ( model ) { model . players = [ ] ; all ( model . configs , config => setupTarget ( model , config ) ) ; calculatePlayers ( model ) ; } export function setupTarget ( model , config ) { const resolvedConfig = resolveRefs ( model . refs , config , true ) as typeof config ; const effects = toEffects ( resolvedConfig ) ; all ( effects , effect => { const player = plugins [ effect . plugin ] . animate ( effect ) as AnimationPlayer ; if ( player ) { player . from = effect . from ; player . to = effect . to ; push ( model . players , player ) ; } } ) ; }