Personal tools
Views

From ProtoScript

Jump to: navigation, search

Contents

YUI:Fade Behavior

Fades the opacity of selected element or elements.

Example

$proto('img#avatar', {
  Fade: {
    opacity: {to: 0.0},
    duration: 0.9
  }
});


The protoscript above says: for an image with id avatar, fade it out when the page loads.

Attributes

Name Description Default Valid Values Example
target Selected element or elements to fade. No value. If no value supplied, use the last targeted element. If value is supplied, use the element(s) selected by the target instead. See Element Scope String value denoting an interface element. See Selecting Elements target:'#avatar'
duration How long the animation should last 0.5 Value from 0.0 to 1.0. 0.0 denotes fully transparent. 1.0 denotes fully opaque. Animate: { opacity: { from:1.0, to:0.5 } } - fade to halfway transparent
method The animation method to use for easing transitions. YAHOO.util.Easing.easeOut YAHOO.util.Easing.backBoth, YAHOO.util.Easing.backIn, YAHOO.util.Easing.backOut, YAHOO.util.Easing.bounceBoth, YAHOO.util.Easing.bounceIn, YAHOO.util.Easing.bounceOut, YAHOO.util.Easing.easeBoth, YAHOO.util.Easing.easeBothStrong, YAHOO.util.Easing.easeIn, YAHOO.util.Easing.easeInStrong, YAHOO.util.Easing.easeNone, YAHOO.util.Easing.easeOut, YAHOO.util.Easing.easeOutStrong, YAHOO.util.Easing.elasticBoth, YAHOO.util.Easing.elasticIn, YAHOO.util.Easing.elasticOut method: YAHOO.utilEasing.easeIn
opacity Animate the opacity (for fade up or down) no default Value from 0.0 to 1.0. 0.0 denotes fully transparent. 1.0 denotes fully opaque. Fade: { opacity: { from:1.0, to:0.5 } } - fade to halfway transparent

Callbacks

Name Description
onStart Called when the animation starts.
onTween Called on each frame of the animation.
onComplete Called when the animation completes.

Demos

See Fade Demo