/ Published in: ActionScript
URL: http://proto.layer51.com/d.aspx?f=1531
usage:
this.createEmptyMovieClip("a", this.getNextHighestDepth()); a.moveTo(20, 20); a.beginFill(0xFF0000, 100); a.lineTo(0, 30); a.lineTo(30, 30); a.lineTo(30, 0); a.lineTo(0, 0); a.endFill();
a.ease("height", 200); a.ease("width, 400, .8, false); a.ease("_x", 200, .1);
Expand |
Embed | Plain Text
//****************************************************************************// // Easing any attribute of any MC // // (c) Copyright 2007 All Rights Reserved // // Rishi Ishairzay [email protected] // // Created 8/01/2007 Last Modified 8/01/2007 // //****************************************************************************// //t:String is target attribute to be eased //v:Float is target value of attribute //s:Float is ease amount ( > 0, < 1) //r:Boolean set to true if you want pixel snapping //calls endEase when easing is complete MovieClip.prototype.ease = function(t, v, s, r) { if (this["_ease_"+t] instanceof MovieClip) { this["_ease_"+t].removeMovieClip(); } mc = this.createEmptyMovieClip("_ease_"+t, this.getNextHighestDepth()); if (s == null) { s = .4; } mc.onEnterFrame = function() { if (d == null) { d = this._parent[t]; } this._parent[t] += (v-this._parent[t])*s; if (r) { this._parent[t] = Math.round(this._parent[t]); } if (Math.abs(this._parent[t]-d)<.05) { this._parent[t] = v; this._parent.endEase(t); delete this.onEnterFrame; this.removeMovieClip(); } }; };
Comments
Subscribe to comments
You need to login to post a comment.

Genius! Works perfectly