animation

Reviews
Shared by: Guillaume
Categories
Tags
Stats
views:
140
rating:
not rated
reviews:
0
posted:
11/6/2007
language:
pages:
0
YUI Library: Animation Simple Use Case myAnimObj = new YAHOO.util.Anim("myDiv", {width: {to: 100}, height: {to: 100}}); myAnimObj.animate(); Makes the HTML element whose id attribute is "myDiv" resize to a height and width of 100 pixels. 2007-7-31 v2.3 Interesting Moments in Animation Event onStart onTween onComplete Fires... ...when anim begins ...on every frame ...when anim ends Arguments YAHOO.util.Anim: Properties attributes (obj) currentFrame (int) duration (num) totalFrames (int) useSeconds (b) [0] {frames: total frames, fps: frames per second, duration: of animation in miliseconds} Constructor (YAHOO.util.Anim, ColorAnim, etc.) YAHOO.util.Anim(str | element target, obj attributes[, num duration, obj easing]); Arguments: (1) Element id or reference: HTML ID or element reference for the element being animated. (2) Attributes object: Defines the qualities being animated; see below. (3) Duration: Approximate, in seconds. (4) Easing: Reference to an easing effect, member of YAHOO.util.Easing. These are Custom Event members of YAHOO.util.Anim; use these by subscribing: myAnimInstance.onComplete.subscribe(myOnCompleteHandler); Using the Motion Subclass Use the Motion subclass to define animations to/from a specific point, using (optional) bezier control points. var attributes = { points: { to: [250, 450], control: [[100, 800], [-100, 200], [500, 500]]}}; YAHOO.util.Anim: Methods animate() getEl() getStartTime() isAnimated() stop(bFinish) if true, advances to last frame of animation var anim = new YAHOO.util.Motion(element, attributes, 1, YAHOO.util.Easing.easeIn); Easing Effects Members of YAHOO.util.Easing Attributes Object animAttributes = { animatedProperty: { by: 100, //start at to: 100, //start at from: 100, //ignore unit: 'em' //can be } } Using the ColorAnim Subclass Use the ColorAnim subclass to background, text or border colors. current, change by this much current, go to this current; start from this any legal numeric unit var myAnim = new YAHOO.util.ColorAnim(element, {back groundColor: { to: '#dcdcdc' } }); myAnim.animate(); Using the Scroll Subclass Use the Scroll subclass to animate horizontal or vertical scrolling of an overflowing page element. var attributes = { scroll: { to: [220, 0] } }; var anim = new YAHOO.util.Scroll(element, attributes, 1, YAHOO.util.Easing.easeOut); Note: Do not include to and by for the same animation property. Animation Properties Use Animation to apply gradual transitions to these properties*: borderWidth bottom fontSize left right top height margin opacity lineHeight padding width backBoth backIn backOut bounceBoth bounceIn bounceOut easeBoth easeBothStrong easeIn easeInStrong easeNone default; no easing easeOut easeOutStrong elasticBoth elasticIn elasticOut Solutions Subscribe to an API method: myAnimObj = new YAHOO.util.Anim(element, {width: {to: 100}, height: {to: 100}}); myHandler = function(type, args) { someDiv.innerHTML = args[0].fps; //gets framesper-second from the onComplete event} myAnimObj.onComplete.subscribe(myHandler); myAnimObj.animate(); *or to any other member of an element's style object that takes a numeric value Dependencies Animation requires the YAHOO Global Object, Dom Collection, and Event Utility.

Shared by: Guillaume
Other docs by Guillaume
YouTube-039-s-Official-Authorities-The-Users-70079
Views: 1667  |  Downloads: 12
YouTube-Fights-Against-Its-Father-Google-55082
Views: 1395  |  Downloads: 11
xna_launch_final_report
Views: 1356  |  Downloads: 5
XNA_Introduction
Views: 1096  |  Downloads: 11
xna
Views: 1028  |  Downloads: 4
XNA Development-1
Views: 1846  |  Downloads: 10
xmas_05
Views: 973  |  Downloads: 0
xerc_users_manual
Views: 1082  |  Downloads: 1
xbst
Views: 1023  |  Downloads: 0
Xbox Way
Views: 1091  |  Downloads: 0
XboxVGA Video Setup
Views: 553  |  Downloads: 0
xbox-router
Views: 369  |  Downloads: 0
xboxnext_security
Views: 244  |  Downloads: 2
XBoxMACAddress
Views: 912  |  Downloads: 0
Related docs
_ Animation
Views: 30  |  Downloads: 3
animation
Views: 9  |  Downloads: 0
Free Animation for Powerpoint
Views: 1818  |  Downloads: 31
Animation
Views: 36  |  Downloads: 2
Animation
Views: 10  |  Downloads: 1
animation colorado
Views: 48  |  Downloads: 2
CS2420 Computer Animation
Views: 19  |  Downloads: 0
3D COMPUTER ANIMATION
Views: 35  |  Downloads: 0
History of Animation
Views: 776  |  Downloads: 29
femdom animation
Views: 45373  |  Downloads: 10
rocket animation
Views: 162  |  Downloads: 2
3D ANIMATION FOUNDATION
Views: 18  |  Downloads: 2
ANIMATION PROGRAM
Views: 1  |  Downloads: 0
12 Animation
Views: 16  |  Downloads: 0
XVL Studio_ Animation
Views: 17  |  Downloads: 0