source/js/animation/TL.Animate.js
function tween(duration, fn, done, ease, from, to) {
    ease = fun(ease) ? ease : morpheus.easings[ease] || nativeTween
    var time = duration || thousand
      , self = this
      , diff = to - from
      , start = now()
      , stop = 0
      , end = 0

    function run(t) {
      var delta = t - start
      if (delta > time || stop) {
        to = isFinite(to) ? to : 1
        stop ? end && fn(to) : fn(to)
        die(run)
        return done && done.apply(self)
      }
      // if you don't specify a 'to' you can use tween as a generic delta tweener
      // cool, eh?
      isFinite(to) ?
        fn((diff * ease(delta / time)) + from) :
        fn(ease(delta / time))
    }

    live(run)

    return {
      stop: function (jump) {
        stop = 1
        end = jump // jump to end of animation?
        if (!jump) done = null // remove callback if not jumping to end
      }
    }
  }
function tween(duration, fn, done, ease, from, to) {
    ease = fun(ease) ? ease : morpheus.easings[ease] || nativeTween
    var time = duration || thousand
      , self = this
      , diff = to - from
      , start = now()
      , stop = 0
      , end = 0

    function run(t) {
      var delta = t - start
      if (delta > time || stop) {
        to = isFinite(to) ? to : 1
        stop ? end && fn(to) : fn(to)
        die(run)
        return done && done.apply(self)
      }
      // if you don't specify a 'to' you can use tween as a generic delta tweener
      // cool, eh?
      isFinite(to) ?
        fn((diff * ease(delta / time)) + from) :
        fn(ease(delta / time))
    }

    live(run)

    return {
      stop: function (jump) {
        stop = 1
        end = jump // jump to end of animation?
        if (!jump) done = null // remove callback if not jumping to end
      }
    }
  }
function tween ( duration , fn , done , ease , from , to ) { ease = fun ( ease ) ? ease : morpheus . easings [ ease ] || nativeTween var time = duration || thousand , self = this , diff = to - from , start = now ( ) , stop = 0 , end = 0 function run ( t ) { var delta = t - start if ( delta > time || stop ) { to = isFinite ( to ) ? to : 1 stop ? end && fn ( to ) : fn ( to ) die ( run ) return done && done . apply ( self ) } // if you don't specify a 'to' you can use tween as a generic delta tweener // cool, eh? isFinite ( to ) ? fn ( ( diff * ease ( delta / time ) ) + from ) : fn ( ease ( delta / time ) ) } live ( run ) return { stop : function ( jump ) { stop = 1 end = jump // jump to end of animation? if ( ! jump ) done = null // remove callback if not jumping to end } } }
Core tween method that requests each frame
@param duration: time in milliseconds. defaults to 1000
@param fn: tween frame callback function receiving 'position'
@param done {optional}: complete callback function
@param ease {optional}: easing method. defaults to easeOut
@param from {optional}: integer to start from
@param to {optional}: integer to end at
@returns method to stop the animation
Core tween method that requests each frame