import { ITimelineModel } from '../core/types' ; import { max , min } from '../utils/math' ; import { _ } from '../utils/constants' ; /**
 * Recalculates the bounds of all animation configurations and the boundaries of the timeline as well
 */ export const calculateConfigs = ( model ) => { var maxTo = 0 ; var cursor = 0 ; var configs = model . configs ; for ( var i = 0 , ilen = configs . length ; i < ilen ; i ++ ) { var config = configs [ i ] ; var times = config . keyframes . map ( k => k . time ) ; var to = max . apply ( _ , times ) ; var from = min . apply ( _ , times ) ; config . to = to ; config . from = from ; config . duration = to - from ; maxTo = max ( to , maxTo ) ; cursor = max ( to + config . endDelay , cursor ) ; } model . cursor = cursor ; model . duration = maxTo ; } ;