transition-native.js revision 5985d0db35cae8ef4c1a022bb03ac15792ff51ad
/**
* Provides the transition method for Node.
* Transition has no API of its own, but adds the transition method to Node.
*
* @module transition
* @requires node-style
*/
var TRANSITION = '-webkit-transition',
TRANSITION_CAMEL = 'WebkitTransition',
TRANSITION_PROPERTY_CAMEL = 'WebkitTransitionProperty',
TRANSITION_PROPERTY = '-webkit-transition-property',
TRANSITION_DURATION = '-webkit-transition-duration',
TRANSITION_TIMING_FUNCTION = '-webkit-transition-timing-function',
TRANSITION_DELAY = '-webkit-transition-delay',
TRANSITION_END = 'webkitTransitionEnd',
ON_TRANSITION_END = 'onwebkittransitionend',
TRANSFORM_CAMEL = 'WebkitTransform',
EMPTY_OBJ = {},
/**
* A class for constructing transition instances.
* Adds the "transition" method to Node.
* @class Transition
* @constructor
*/
Transition = function() {
};
Transition.fx = {};
Transition.toggles = {};
Transition._hasEnd = {};
return m1.toUpperCase();
});
return property;
};
var str = '';
if (m1) {
}
if (m3) {
}
return str;
});
return property;
};
Transition.useNative = false;
Transition.useNative = true;
}
Transition._nodeAttrs = {};
Transition.prototype = {
var anim = this;
}
return anim;
},
var anim = this,
dur,
attr,
val;
if (!attrs) {
}
// might just be a value
}
if (typeof val === 'function') {
}
// take control if another transition owns this property
}
}
// make 0 async and fire events
};
// native end event doesnt fire when setting to same value
// supplementing with timer
// val may be a string or number (height: 0, etc), but computedStyle is always string
setTimeout(function() {
});
}, dur * 1000);
}
},
removeProperty: function(prop) {
var anim = this,
}
},
var attr,
}
// when size is auto or % webkit starts from zero instead of computed
// TODO: selective set
}
}
}
},
/**
* Starts or an animation.
* @method run
* @chainable
* @private
*/
var anim = this,
data = {
type: 'transition:start',
};
//anim._node.fire('transition:start', data);
}
}
return anim;
},
_start: function() {
this._runNative();
},
return dur + 's';
},
_runNative: function(time) {
var anim = this,
cssText = '',
attr,
name;
// preserve existing transitions
if (cssTransition !== 'all') {
}
// run transitions mapped to this instance
} else {
this.removeProperty(name);
}
}
}
// only one native end event per node
//anim._detach = Y.on(TRANSITION_END, anim._onNativeEnd, node);
//node[ON_TRANSITION_END] = anim._onNativeEnd;
}
//setTimeout(function() { // allow updates to apply (size fix, onstart, etc)
//}, 1);
},
var anim = this,
data = {
type: 'transition:end',
},
if (node) {
setTimeout(function() { // IE: allow previous update to finish
// nested to ensure proper fire order
if (callback) {
}
}, 1);
} else if (callback) {
setTimeout(function() { // IE: allow previous update to finish
}, 1);
}
//node.fire('transition:end', data);
}
},
_endNative: function(name) {
if (typeof value === 'string') {
}
},
_onNativeEnd: function(e) {
var node = this,
event = e,//e._event,
data,
if (anim) {
data = {
type: 'propertyEnd',
};
}
//node.fire('transition:propertyEnd', data);
}
}
},
destroy: function() {
var anim = this;
/*
if (anim._detach) {
anim._detach.detach();
}
*/
//anim._node[ON_TRANSITION_END] = null;
}
};
Y.Transition = Transition;
/**
* Animate one or more css properties to a given value. Requires the "transition" module.
* <pre>example usage:
* Y.one('#demo').transition({
* duration: 1, // in seconds, default is 0.5
* easing: 'ease-out', // default is 'ease'
* delay: '1', // delay start for 1 second, default is 0
*
* height: '10px',
* width: '10px',
*
* opacity: { // per property
* value: 0,
* duration: 2,
* delay: 2,
* easing: 'ease-in'
* }
* });
* </pre>
* @for Node
* @method transition
* @param {Object} config An object containing one or more style properties, a duration and an easing.
* @param {Function} callback A function to run after the transition has completed.
* @chainable
*/
var
prop;
if (typeof config === 'function') {
config = null;
}
}
}
}
} else {
}
} else { // name is a config, config is a callback or undefined
}
} else {
}
return this;
};
this._show(); // show prior to transition
if (name && Y.Transition) {
if (typeof name !== 'string' && !name.push) { // named effect or array of effects supercedes default
if (typeof config === 'function') {
}
name = this.SHOW_TRANSITION;
}
}
else if (name && !Y.Transition) { Y.log('unable to transition show; missing transition module', 'warn', 'node'); }
return this;
};
return function() {
if (fn) {
}
if (callback) {
}
};
};
if (name && Y.Transition) {
if (typeof config === 'function') {
config = null;
}
if (typeof name !== 'string' && !name.push) { // named effect or array of effects supercedes default
if (typeof config === 'function') {
}
name = this.HIDE_TRANSITION;
}
} else if (name && !Y.Transition) { Y.log('unable to transition hide; missing transition module', 'warn', 'node'); // end if on nex
} else {
this._hide();
}
return this;
};
/**
* Animate one or more css properties to a given value. Requires the "transition" module.
* <pre>example usage:
* Y.all('.demo').transition({
* duration: 1, // in seconds, default is 0.5
* easing: 'ease-out', // default is 'ease'
* delay: '1', // delay start for 1 second, default is 0
*
* height: '10px',
* width: '10px',
*
* opacity: { // per property
* value: 0,
* duration: 2,
* delay: 2,
* easing: 'ease-in'
* }
* });
* </pre>
* @for NodeList
* @method transition
* @param {Object} config An object containing one or more style properties, a duration and an easing.
* @param {Function} callback A function to run after the transition has completed. The callback fires
* once per item in the NodeList.
* @chainable
*/
i = 0,
node;
}
return this;
};
var callback;
}
}
if (on) {
this._show();
} else {
}
};
i = 0,
node;
}
return this;
};
fadeOut: {
opacity: 0,
duration: 0.5,
easing: 'ease-out'
},
fadeIn: {
opacity: 1,
duration: 0.5,
easing: 'ease-in'
},
sizeOut: {
height: 0,
width: 0,
duration: 0.75,
easing: 'ease-out'
},
sizeIn: {
},
},
duration: 0.5,
easing: 'ease-in',
on: {
start: function() {
this._transitionOverflow = overflow;
}
},
end: function() {
if (this._transitionOverflow) { // revert overridden value
}
}
}
}
});
});