]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/jquery/src/effects/Tween.js
9acd8d0cc9966678a6269788c513d6b1183b97c4
4 ], function( jQuery
) {
6 function Tween( elem
, options
, prop
, end
, easing
) {
7 return new Tween
.prototype.init( elem
, options
, prop
, end
, easing
);
13 init: function( elem
, options
, prop
, end
, easing
, unit
) {
16 this.easing
= easing
|| "swing";
17 this.options
= options
;
18 this.start
= this.now
= this.cur();
20 this.unit
= unit
|| ( jQuery
.cssNumber
[ prop
] ? "" : "px" );
23 var hooks
= Tween
.propHooks
[ this.prop
];
25 return hooks
&& hooks
.get ?
27 Tween
.propHooks
._default
.get( this );
29 run: function( percent
) {
31 hooks
= Tween
.propHooks
[ this.prop
];
33 if ( this.options
.duration
) {
34 this.pos
= eased
= jQuery
.easing
[ this.easing
](
35 percent
, this.options
.duration
* percent
, 0, 1, this.options
.duration
38 this.pos
= eased
= percent
;
40 this.now
= ( this.end
- this.start
) * eased
+ this.start
;
42 if ( this.options
.step
) {
43 this.options
.step
.call( this.elem
, this.now
, this );
46 if ( hooks
&& hooks
.set ) {
49 Tween
.propHooks
._default
.set( this );
55 Tween
.prototype.init
.prototype = Tween
.prototype;
59 get: function( tween
) {
62 if ( tween
.elem
[ tween
.prop
] != null &&
63 (!tween
.elem
.style
|| tween
.elem
.style
[ tween
.prop
] == null) ) {
64 return tween
.elem
[ tween
.prop
];
67 // Passing an empty string as a 3rd parameter to .css will automatically
68 // attempt a parseFloat and fallback to a string if the parse fails.
69 // Simple values such as "10px" are parsed to Float;
70 // complex values such as "rotate(1rad)" are returned as-is.
71 result
= jQuery
.css( tween
.elem
, tween
.prop
, "" );
72 // Empty strings, null, undefined and "auto" are converted to 0.
73 return !result
|| result
=== "auto" ? 0 : result
;
75 set: function( tween
) {
76 // Use step hook for back compat.
77 // Use cssHook if its there.
78 // Use .style if available and use plain properties where available.
79 if ( jQuery
.fx
.step
[ tween
.prop
] ) {
80 jQuery
.fx
.step
[ tween
.prop
]( tween
);
81 } else if ( tween
.elem
.style
&& ( tween
.elem
.style
[ jQuery
.cssProps
[ tween
.prop
] ] != null || jQuery
.cssHooks
[ tween
.prop
] ) ) {
82 jQuery
.style( tween
.elem
, tween
.prop
, tween
.now
+ tween
.unit
);
84 tween
.elem
[ tween
.prop
] = tween
.now
;
91 // Panic based approach to setting things on disconnected nodes
92 Tween
.propHooks
.scrollTop
= Tween
.propHooks
.scrollLeft
= {
93 set: function( tween
) {
94 if ( tween
.elem
.nodeType
&& tween
.elem
.parentNode
) {
95 tween
.elem
[ tween
.prop
] = tween
.now
;
101 linear: function( p
) {
104 swing: function( p
) {
105 return 0.5 - Math
.cos( p
* Math
.PI
) / 2;
109 jQuery
.fx
= Tween
.prototype.init
;
111 // Back Compat <1.8 extension point