- Home
- Categorie
- Digital Marketing
- Grafica, Visual Design & UX
- Problema con penner easing
-
Problema con penner easing
Con rande rammarico ho dovuto, per forza di cosa, mettere mano ad un progetto in flash del 2006...
Se non fosse che dal 2006 ad oggi, fortunatamente, ho cambiato più di un pc ed ora sono giunto al mac.
Problema.
Apro il file .fla con flash cs6... ma ovviamente i movimenti dinamici di allora creati con le equazioni di Penner non vanno. Allora spolvero i ricordi e cacio mente locale al fatto che non ho aggiunto la cartella com/easing blabla nella cartella Classes di Flash...
Riavvio Flash, niente.
Riavvio il Mac, niente.Potete aiutarmi per favore? Grazieeeeeee
Il FLA, al primo fotogramma importa questo:
if (_global.$tweenManager == undefined){ _global.$tweenManager = new zigo.tweenManager(); } else { _global.$tweenManager.cleanUp(); _global.$tweenManager.init(); } com.robertpenner.easing.Back; com.robertpenner.easing.Bounce; com.robertpenner.easing.Circ; com.robertpenner.easing.Cubic; com.robertpenner.easing.Elastic; com.robertpenner.easing.Expo; com.robertpenner.easing.Linear; com.robertpenner.easing.Quad; com.robertpenner.easing.Quart; com.robertpenner.easing.Quint; com.robertpenner.easing.Sine; var Mp = MovieClip.prototype; Mp.addListener = function () { if (!this._listeners) { AsBroadcaster.initialize(this); } this.addListener.apply(this, args); }; ASSetPropFlags(Mp, "addListener", 1, 0); Mp.tween = function (props, pEnd, seconds, animType, delay, callback, extra1, extra2) { if (_global.$tweenManager.isTweenLocked(this)) { trace("tween not added, this movieclip is locked"); return(undefined); } if (arguments.length < 2) { trace("tween not added, props & pEnd must be defined"); return(undefined); } if (typeof(props) == "string") { if (props.indexOf(",") > -1) { props = props.split(" ").join("").split(","); } else { props = [props]; } } if (!(pEnd instanceof Array)) { pEnd = [pEnd]; while (pEnd.length < props.length) { pEnd.push(pEnd[0]); } // end while } if (seconds == undefined) { seconds = 2; } else if (seconds < 0.010000) { seconds = 0; } if (delay < 0.010000 || delay == undefined) { delay = 0; } switch (typeof(animType)) { case "string": { animType = animType.toLowerCase(); if (animType == "linear") { var eqf = com.robertpenner.easing.Linear.easeNone; } else if (animType.indexOf("easeoutin") == 0) { var t = animType.substr(9); t = t.charAt(0).toUpperCase() + t.substr(1); var eqf = com.robertpenner.easing.easeOutIn; } else if (animType.indexOf("easeinout") == 0) { var t = animType.substr(9); t = t.charAt(0).toUpperCase() + t.substr(1); var eqf = com.robertpenner.easing.easeInOut; } else if (animType.indexOf("easein") == 0) { var t = animType.substr(6); t = t.charAt(0).toUpperCase() + t.substr(1); var eqf = com.robertpenner.easing.easeIn; } else if (animType.indexOf("easeout") == 0) { var t = animType.substr(7); t = t.charAt(0).toUpperCase() + t.substr(1); var eqf = com.robertpenner.easing.easeOut; } if (eqf == undefined) { var eqf = com.robertpenner.easing.Expo.easeOut; } break; } case "function": { var eqf = animType; break; } case "object": { if (animType.ease != undefined && animType.pts != undefined) { var eqf = animType.ease; extra1 = animType.pts; } else { var eqf = com.robertpenner.easing.Expo.easeOut; } break; } default: { var eqf = com.robertpenner.easing.Expo.easeOut; } } // End of switch switch (typeof(callback)) { case "function": { callback = {func: callback, scope: this._parent}; break; } case "string": { var ilp; var funcp; var scope; var args; var a; ilp = callback.indexOf("("); funcp = callback.slice(0, ilp); scope = funcp.slice(0, funcp.lastIndexOf(".")); func = funcp; args = callback.slice(ilp + 1, callback.lastIndexOf(")")).split(","); var i = 0; while (i < args.length) { a = args*; if (a != undefined) { args* = a; } i++; } // end while callback = {func: func, scope: scope, args: args}; break; } } // End of switch if (_global.$tweenManager.autoStop) { _global.$tweenManager.removeTween(this); } if (delay > 0) { _global.$tweenManager.addTweenWithDelay(delay, this, props, pEnd, seconds, eqf, callback, extra1, extra2); } else { _global.$tweenManager.addTween(this, props, pEnd, seconds, eqf, callback, extra1, extra2); } }; Mp.stopTween = function (props) { if (typeof(props) == "string") { if (props.indexOf(",") > -1) { var _l3 = props.split(" ").join("").split(","); } else { _l3 = [_l3]; } } _global.$tweenManager.removeTween(this, _l3); }; Mp.isTweening = function (prop) { return(_global.$tweenManager.isTweening(this, prop)); }; Mp.getTweens = function () { return(_global.$tweenManager.getTweens(this)); }; Mp.lockTween = function () { _global.$tweenManager.lockTween(this, true); }; Mp.unlockTween = function () { _global.$tweenManager.lockTween(this, false); }; Mp.isTweenLocked = function () { return(_global.$tweenManager.isTweenLocked(this)); }; Mp.isTweenPaused = function (prop) { return(_global.$tweenManager.isTweenPaused(this, prop)); }; Mp.pauseTween = function (props) { var _l4; if (props != undefined) { if (typeof(props) == "string") { if (props.indexOf(",") > -1) { var _l3 = props.split(" ").join("").split(","); } else { _l3 = [_l3]; } } _l4 = {}; while (_l3 != null) { var _l5 = _l3; _l4[_l3[_l5]] = true; } // end while } _global.$tweenManager.pauseTween(this, _l4); }; Mp.unpauseTween = function (props) { var _l4; if (props != undefined) { if (typeof(props) == "string") { if (props.indexOf(",") > -1) { var _l3 = props.split(" ").join("").split(","); } else { _l3 = [_l3]; } } _l4 = {}; while (_l3 != null) { var _l5 = _l3; _l4[_l3[_l5]] = true; } // end while } _global.$tweenManager.unpauseTween(this, _l4); }; Mp.pauseAllTweens = function () { _global.$tweenManager.pauseTween(); }; Mp.unpauseAllTweens = function () { _global.$tweenManager.unpauseTween(); }; Mp.stopAllTweens = function () { _global.$tweenManager.stopAll(); }; Mp.ffTween = function (props) { var _l4; if (props != undefined) { if (typeof(props) == "string") { if (props.indexOf(",") > -1) { var _l3 = props.split(" ").join("").split(","); } else { _l3 = [_l3]; } } _l4 = {}; while (_l3 != null) { var _l5 = _l3; _l4[_l3[_l5]] = true; } // end while } _global.$tweenManager.ffTween(this, _l4); }; Mp.rewTween = function (props) { var _l4; if (props != undefined) { if (typeof(props) == "string") { if (props.indexOf(",") > -1) { var _l3 = props.split(" ").join("").split(","); } else { _l3 = [_l3]; } } _l4 = {}; while (_l3 != null) { var _l5 = _l3; _l4[_l3[_l5]] = true; } // end while } _global.$tweenManager.rewTween(this, _l4); }; Mp.alphaTo = function (destAlpha, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_alpha"], [destAlpha], seconds, animType, delay, callback, extra1, extra2); }; Mp.scaleTo = function (destScale, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_xscale", "_yscale"], [destScale, destScale], seconds, animType, delay, callback, extra1, extra2); }; Mp.sizeTo = function (destSize, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_width", "_height"], [destSize, destSize], seconds, animType, delay, callback, extra1, extra2); }; Mp.slideTo = function (destX, destY, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_x", "_y"], [destX, destY], seconds, animType, delay, callback, extra1, extra2); }; Mp.rotateTo = function (destRotation, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_rotation"], [destRotation], seconds, animType, delay, callback, extra1, extra2); }; _global.getColorTransObj = function (type, amt, rgb) { switch (type) { case "brightness": { var _l4 = 100 - Math.abs(amt); var _l6 = 0; if (amt > 0) { _l6 = 256 * (amt / 100); } return({ra: _l4, rb: _l6, ga: _l4, gb: _l6, ba: _l4, bb: _l6}); } case "brightOffset": { _l6 = 256 * (amt / 100); return({ra: 100, rb: _l6, ga: 100, gb: _l6, ba: 100, bb: _l6}); } case "contrast": { var _l2 = {}; _l2.ra = _l2.ga = _l2.ba = amt; _l2.rb = _l2.gb = _l2.bb = 128 - 1.280000 * amt; return(_l2); } case "invertColor": { _l2 = {}; _l2.ra = _l2.ga = _l2.ba = 100 - 2 * amt; _l2.rb = _l2.gb = _l2.bb = amt * 2.550000; return(_l2); } case "tint": { if (rgb == undefined || rgb == null) { break; } var _l8 = rgb >> 16; var _l9 = rgb >> 8 & 255; var _l7 = rgb & 255; var _l5 = amt / 100; _l2 = {rb: _l8 * _l5, gb: _l9 * _l5, bb: _l7 * _l5}; _l2.ra = _l2.ga = _l2.ba = 100 - amt; return(_l2); } } // End of switch return({rb: 0, ra: 100, gb: 0, ga: 100, bb: 0, ba: 100}); }; Mp.brightnessTo = function (bright, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_ct_"], [getColorTransObj("brightness", bright)], seconds, animType, delay, callback, extra1, extra2); }; Mp.brightOffsetTo = function (percent, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_ct_"], [getColorTransObj("brightOffset", percent)], seconds, animType, delay, callback, extra1, extra2); }; Mp.contrastTo = function (percent, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_ct_"], [getColorTransObj("contrast", percent)], seconds, animType, delay, callback, extra1, extra2); }; Mp.colorTo = function (rgb, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_ct_"], [getColorTransObj("tint", 100, rgb)], seconds, animType, delay, callback, extra1, extra2); }; Mp.colorTransformTo = function (ra, rb, ga, gb, ba, bb, aa, ab, seconds, animType, delay, callback, extra1, extra2) { var _l2 = {ra: ra, rb: rb, ga: ga, gb: gb, ba: ba, bb: bb, aa: aa, ab: ab}; this.tween(["_ct_"], [_l2], seconds, animType, delay, callback, extra1, extra2); }; Mp.invertColorTo = function (percent, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_ct_"], [getColorTransObj("invertColor", percent)], seconds, animType, delay, callback, extra1, extra2); }; Mp.tintTo = function (rgb, percent, seconds, animType, delay, callback, extra1, extra2) { this.tween(["_ct_"], [getColorTransObj("tint", percent, rgb)], seconds, animType, delay, callback, extra1, extra2); }; Mp.getFrame = function () { return(this._currentframe); }; Mp.setFrame = function (fr) { this.gotoAndStop(Math.round(fr)); }; Mp.addProperty("_frame", Mp.getFrame, Mp.setFrame); Mp.frameTo = function (endframe, duration, animType, delay, callback, extra1, extra2) { if (endframe == undefined) { var _l2 = this._totalframes; } this.tween("_frame", _l2, duration, animType, delay, callback, extra1, extra2); }; var TFP = TextField.prototype; if (!TFP.origAddListener) { TFP.origAddListener = TFP.addListener; ASSetPropFlags(TFP, "origAddListener", 1, 0); TFP.addListener = function () { if (!this._listeners) { AsBroadcaster.initialize(this); } this.origAddListener.apply(this, args); }; } var $_$methods = ["tween", "stopTween", "isTweening", "getTweens", "lockTween", "isTweenLocked", "unlockTween", "isTweenPaused", "pauseTween", "unpauseTween", "pauseAllTweens", "unpauseAllTweens", "stopAllTweens", "ffTween", "rewTween", "getFrame", "setFrame", "_frame", "frameTo", "alphaTo", "brightnessTo", "colorTo", "colorTransformTo", "invertColorTo", "tintTo", "scaleTo", "sizeTo", "slideTo", "rotateTo", "brightOffsetTo", "contrastTo"]; for (var $_$i in $_$methods) { ASSetPropFlags(Mp, $_$methods[$_$i], 1, 0); if ($_$methods[$_$i].toLowerCase().indexOf("frame") == -1) { TFP[$_$methods[$_$i]] = Mp[$_$methods[$_$i]]; ASSetPropFlags(TFP, $_$methods[$_$i], 1, 0); } } delete Mp; delete TFP; delete $_$methods; delete $_$i;