-------------------------------------------------------------------------------- -- Handler.......... : onEnterFrame -- Author........... : -- Description...... : -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function SimpleAnimation_Character.onEnterFrame ( ) -------------------------------------------------------------------------------- local o = this.getObject ( ) if ( object.hasController ( o, object.kControllerTypeAnimation ) ) then local cur = this.nCurFactor ( ) local dst = this.nDstFactor ( ) if ( cur ~= dst ) then local dt = application.getLastFrameTime ( ) if ( dst > cur ) then cur = math.min ( cur + dt, 1 ) else cur = math.max ( cur - dt, 0 ) end this.nCurFactor ( cur ) animation.setPlaybackLevel ( o, 0, 1 - cur ) animation.setPlaybackLevel ( o, 1, cur ) end end -------------------------------------------------------------------------------- end --------------------------------------------------------------------------------