  | |  | Convertig Prototype to Class | Convertig Prototype to Class
2004-02-19 - By Claudia Barnal
Back Hello,
I was wondering if you could please help me (if possible) convert these
prototypes into a Class, or how would I go on about doing it...
These activate Robert Penner 's easing equations, and is used like this:
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
this.initEase([ '_xscale ', '_yscale], [710, 310], [0.4, 0.4], [ 'easeOutQuad ',
'easeOutQuad ']);
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Thank you for your help,
Claudia
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
MovieClip.prototype.initEase = function(prop, targ, dur, meth) {
this.total = prop.length;
for (i=0; i <prop.length; i++) {
this[ "prop "+i] = prop[i];
this[ "t "+i] = getTimer();
this[ "targ "+i] = targ[i];
this[ "dur "+i] = dur[i]*1000;
this[ "meth "+i] = meth[i];
this[ "s "+i] = this[prop[i]];
this[ "c "+i] = this[ "targ "+i]-this[this[ "prop "+i]];
}
for (i=0; i <prop.length; i++) {
if (this[ "easer "+prop[i]+i]) {
clearInterval(this[ "easer "+prop[i]+i]);
}
this[ "easer "+prop[i]+i] = setInterval(doEase, 10, this);
}
};
MovieClip.prototype.doEase = function(w) {
for (i=0; i <w.total; i++) {
var now = getTimer();
var diff = now-w[ "t "+i];
if (diff <w[ "dur "+i]) {
var z = Math[w[ "meth "+i]](diff, w[ "s "+i], w[ "c "+i],
w[ "dur "+i]);
w[w[ "prop "+[i]]] = z;
} else {
clearInterval(w[ "easer "+w[ "prop "+i]+i]);
w[w[ "prop "+[i]]] = w[ "targ "+i];
}
}
};
MovieClip.prototype.killEase = function() {
for (i=0; i <this.total; i++) {
clearInterval(this[ "easer "+this[ "prop "][i]+i]);
}
};
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104692
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |