Contains Fx.Tween and the Element shortcut Element.tween.
Extends:The Tween effect, used to transition any CSS property from one value to another.
Syntax:var myFx = new Fx.Tween(element, [, options]);
Arguments:
Tweens the height of a element while clicking a link (which stops the default behavior), using a transition and a long duration. It uses the link
option so when clicking the link twice it behaves smoothly. When the start value is omitted, the current value of the property (in this example the height property) will be used.
var myFx = new Fx.Tween('myElement', {
duration: 'long',
transition: 'bounce:out',
link: 'cancel',
property: 'height'
});
document.id('myLink').addEvent('click', function(event){
event.stop();
myFx.start(40, 100);
});
It is also possible to use the Element properties: .get('tween')
and .set('tween')
and the tween
method. In this example the property method is not set as an option, now it should be set as argument of the tween
method. This is something you can choose for both the Fx.Tween
constructor or this approach.
var myElement = document.id('myElement');
myElement.set('tween', {
duration: 'long',
transition: 'bounce:out',
link: 'cancel'
});
document.id('myLink').addEvent('click', function(event){
event.stop();
myElement.tween('height', 40, 100);
});
Sets the Element's CSS property to the specified value immediately.
Syntax:myFx.set(property, value);
Arguments:
var myFx = new Fx.Tween(element);
myFx.set('background-color', '#f00');
Note:
If you use the property option, you must not use the property argument in the start and set methods.
Transitions the Element's CSS property to the specified value.
Syntax:myFx.start([property,] [from,] to);
Arguments:
var myFx = new Fx.Tween(element);
myFx.start('background-color', '#000', '#f00');
myFx.start('background-color', '#00f');
Notes:
Sets and gets default options for the Fx.Tween instance of an Element.
Setter: Syntax:el.set('tween'[, options]);
Arguments:
el.set('tween', {duration: 'long'});
el.tween('color', '#f00');
Getter:
Syntax:
el.get('tween');
Arguments:
el.get('tween').start(0);
Notes:
Custom Type to allow all of its methods to be used with any DOM element via the dollar function $.
Element shortcut method which immediately transitions any single CSS property of an Element from one value to another.
Syntax:myElement.tween(property, startValue[, endValue]);
Arguments:
$('myElement').tween('width', '100');
$('myElement').tween('height', [20, 200]);
$('myElement').tween('border', '6px solid #36f');
See Also:
Element shortcut method for tween with opacity. Useful for fading an Element in and out or to a certain opacity level.
Syntax:myElement.fade([how]);
Arguments:
$('myElement').fade('out');
$('myElement').fade(0.7);
Element shortcut method for tweening the background color. Immediately transitions an Element's background color to a specified highlight color then back to its set background color.
Syntax:myElement.highlight([start, end]);
Arguments:
If no background color is set on the Element, or its background color is set to 'transparent', the default end value will be white.
Returns:
$('myElement').highlight('#ddf');
$('myElement').highlight('#ddf', '#ccc');
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4