import { loopOff } from '../core/timeloop' ; import { ITimelineModel } from '../core/types' ; import { S_PAUSED , _ } from '../utils/constants' ; import { destroy } from './destroy' ; import { update } from './update' ; import { FINISH } from '../actions' ; import { IReducer , IReducerContext } from '../core/types' ; 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 ) ; } } ;