(elem, properties, options)
| 83 | } |
| 84 | |
| 85 | function Animation(elem, properties, options) { |
| 86 | var result, |
| 87 | stopped, |
| 88 | index = 0, |
| 89 | length = animationPrefilters.length, |
| 90 | deferred = jQuery.Deferred().always(function() { |
| 91 | // don't match elem in the :animated selector |
| 92 | delete tick.elem; |
| 93 | }), |
| 94 | tick = function() { |
| 95 | if (stopped) { |
| 96 | return false; |
| 97 | } |
| 98 | var currentTime = fxNow || createFxNow(), |
| 99 | remaining = Math.max(0, animation.startTime + animation.duration - currentTime), |
| 100 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
| 101 | temp = remaining / animation.duration || 0, |
| 102 | percent = 1 - temp, |
| 103 | index = 0, |
| 104 | length = animation.tweens.length; |
| 105 | |
| 106 | for (; index < length; index++) { |
| 107 | animation.tweens[index].run(percent); |
| 108 | } |
| 109 | |
| 110 | deferred.notifyWith(elem, [animation, percent, remaining]); |
| 111 | |
| 112 | if (percent < 1 && length) { |
| 113 | return remaining; |
| 114 | } else { |
| 115 | deferred.resolveWith(elem, [animation]); |
| 116 | return false; |
| 117 | } |
| 118 | }, |
| 119 | animation = deferred.promise({ |
| 120 | elem : elem, |
| 121 | props : jQuery.extend({}, properties), |
| 122 | opts : jQuery.extend(true, { |
| 123 | specialEasing : {} |
| 124 | }, options), |
| 125 | originalProperties : properties, |
| 126 | originalOptions : options, |
| 127 | startTime : fxNow || createFxNow(), |
| 128 | duration : options.duration, |
| 129 | tweens : [], |
| 130 | createTween: function(prop, end) { |
| 131 | var tween = jQuery.Tween(elem, animation.opts, prop, end, |
| 132 | animation.opts.specialEasing[prop] || animation.opts.easing); |
| 133 | animation.tweens.push(tween); |
| 134 | return tween; |
| 135 | }, |
| 136 | stop: function(gotoEnd) { |
| 137 | var index = 0, |
| 138 | // if we are going to the end, we want to run all the tweens |
| 139 | // otherwise we skip this part |
| 140 | length = gotoEnd ? animation.tweens.length : 0; |
| 141 | if (stopped) { |
| 142 | return this; |
no test coverage detected