📄 tween.as
字号:
if (!applied) { // Creates a new filter and applies it var myFilter; var quality = extras.__special_blur_quality__ == undefined ? 2 : extras.__special_blur_quality__; // Quality if (propName == "blur_blurX") myFilter = new flash.filters.BlurFilter(propValue, 0, quality); if (propName == "blur_blurY") myFilter = new flash.filters.BlurFilter(0, propValue, quality); newFilters.push(myFilter); } } else if (propName.substr(0, 5) == "glow_") { // Glow... for (i=0; i<mtarget.filters.length; i++) { if (newFilters[i] instanceof flash.filters.GlowFilter) { newFilters[i][propName.substr(5)] = propValue; if (extras.__special_glow_quality__ != undefined) newFilters[i].quality = extras.__special_glow_quality__; // Applies quality if (extras.__special_glow_inner__!= undefined) newFilters[i].inner = extras.__special_glow_inner__; // Applies inner if (extras.__special_glow_knockout__ != undefined) newFilters[i].knockout = extras.__special_glow_knockout__; // Applies knockout applied = true; break; } } if (!applied) { // Creates a new filter and applies it var myFilter; var quality = extras.__special_glow_quality__ == undefined ? 2 : extras.__special_glow_quality__; // Quality var inner = extras.__special_glow_inner__ == undefined ? false : extras.__special_glow_inner__; // Inner var knockout = extras.__special_glow_knockout__ == undefined ? false : extras.__special_glow_knockout__; // Knockout if (propName == "glow_color") myFilter = new flash.filters.GlowFilter(propValue, 1, 0, 0, 1, quality, inner, knockout); if (propName == "glow_alpha") myFilter = new flash.filters.GlowFilter(0xffffff, propValue, 0, 0, 1, quality, inner, knockout); if (propName == "glow_blurX") myFilter = new flash.filters.GlowFilter(0xffffff, 1, propValue, 0, 1, quality, inner, knockout); if (propName == "glow_blurY") myFilter = new flash.filters.GlowFilter(0xffffff, 1, 0, propValue, 1, quality, inner, knockout); if (propName == "glow_strength") myFilter = new flash.filters.GlowFilter(0xffffff, 1, 0, 0, propValue, quality, inner, knockout); newFilters.push(myFilter); } } else if (propName.substr(0, 6) == "bevel_") { // Bevel... for (i=0; i<mtarget.filters.length; i++) { if (newFilters[i] instanceof flash.filters.BevelFilter) { newFilters[i][propName.substr(6)] = propValue; if (extras.__special_bevel_quality__ != undefined) newFilters[i].quality = extras.__special_bevel_quality__; // Applies quality if (extras.__special_bevel_type__!= undefined) newFilters[i].inner = extras.__special_bevel_type__; // Applies type if (extras.__special_bevel_knockout__ != undefined) newFilters[i].knockout = extras.__special_bevel_knockout__; // Applies knockout applied = true; break; } } if (!applied) { // Creates a new filter and applies it var myFilter; var quality = extras.__special_bevel_quality__ == undefined ? 2 : extras.__special_bevel_quality__; // Quality var type = extras.__special_bevel_type__ == undefined ? "inner" : extras.__special_bevel_type__; // Inner var knockout = extras.__special_bevel_knockout__ == undefined ? false : extras.__special_bevel_knockout__; // Knockout if (propName == "bevel_distance") myFilter = new flash.filters.BevelFilter(propValue, 45, 0xffffff, 1, 0x000000, 1, 0, 0, 1, quality, type, knockout); if (propName == "bevel_angle") myFilter = new flash.filters.BevelFilter(0, propValue, 0xffffff, 1, 0x000000, 1, 0, 0, 1, quality, type, knockout); if (propName == "bevel_highlightColor") myFilter = new flash.filters.BevelFilter(0, 45, propValue, 1, 0x000000, 1, 0, 0, 1, quality, type, knockout); if (propName == "bevel_highlightAlpha") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, propValue, 0x000000, 1, 0, 0, 1, quality, type, knockout); if (propName == "bevel_shadowColor") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, propValue, 1, 0, 0, 1, quality, type, knockout); if (propName == "bevel_shadowAlpha") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, propValue, 0, 0, 1, quality, type, knockout); if (propName == "bevel_blurX") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, propValue, 0, 1, quality, type, knockout); if (propName == "bevel_blurY") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, propValue, 1, quality, type, knockout); if (propName == "bevel_strength") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, 0, propValue, quality, type, knockout); newFilters.push(myFilter); } } else { // Can't do anything// trace ("MC TWEEN ### Error on $setFilterProperty: propName \""+propName+"\" is not valid."); return; } // And reapplies the filter mtarget.filters = newFilters;};/*===============================================================================MAIN METHODS/FUNCTIONS-------------------------------------------------------------------------------The most basic tweening functions - for starting, stopping, pausing, etc.-------------------------------------------------------------------------------*/MovieClip.prototype.tween = TextField.prototype.tween = Sound.prototype.tween = function (prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2) { // Starts a variable/property/attribute tween for an specific object. _global.$addTween(this, prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2);};ASSetPropFlags(MovieClip.prototype, "tween", 1, 0);ASSetPropFlags(TextField.prototype, "tween", 1, 0);ASSetPropFlags(Sound.prototype, "tween", 1, 0);MovieClip.prototype.roundedTween = TextField.prototype.roundedTween = Sound.prototype.roundedTween = function (prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2) { // Starts a variable/property/attribute tween for an specific object, and uses only rounded values when updating _global.$addTween(this, prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2, {mustRound:true});};ASSetPropFlags(MovieClip.prototype, "roundedTween", 1, 0);ASSetPropFlags(TextField.prototype, "roundedTween", 1, 0);ASSetPropFlags(Sound.prototype, "roundedTween", 1, 0);MovieClip.prototype.stopTween = TextField.prototype.stopTween = Sound.prototype.stopTween = function(props) { // Removes tweenings immediately, leaving objects as-is. Examples: // <movieclip>.stopTween ("_x"); // Stops _x tweening // <movieclip>.stopTween (["_x", "_y"]); // Stops _x and _y tweening // <movieclip>.stopTween ("_x", "_y"); // Stops _x and _y tweening // <movieclip>.stopTween (); // Stops all tweening processes if (typeof (props) == "string") props = [props]; // in case of one property, turn into array if (props != undefined) { // 2.22.26: counts all arguments as parameters too for (var i=1; i<arguments.length; i++) props.push(arguments[i]); } _global.$stopTween(this, props, true);};ASSetPropFlags(MovieClip.prototype, "stopTween", 1, 0);ASSetPropFlags(TextField.prototype, "stopTween", 1, 0);ASSetPropFlags(Sound.prototype, "stopTween", 1, 0);MovieClip.prototype.pauseTween = TextField.prototype.pauseTween = Sound.prototype.pauseTween = function(props) { // Pauses all tweenings currently being executed for this object (this includes delayed tweenings), unless specific property names are passed as a parameter. // Examples: // <sound>.pauseTween(); // <movieclip>.pauseTween("_x"); // <textfield>.pauseTween("_alpha", "_y"); if (props != undefined) { if (typeof (props) == "string") props = [props]; // in case of one property, turn into array for (var i=1; i<Arguments.length; i++) props.push(Arguments[i]); } var tweenPropList = _root.__tweenController__.$_tweenPropList; var mustPause; for (var pti in tweenPropList) { if (tweenPropList[pti]._targ == this && !tweenPropList[pti]._isPaused) { if (props != undefined) { // Tests if it can be stopped mustPause = false; for (var i in props) { if (props[i] == tweenPropList[pti]._prop) { mustPause = true; break; } } } if (props == undefined || mustPause) { tweenPropList[pti]._isPaused = true; tweenPropList[pti]._timePaused = _root.__tweenController__.$_tTime; } } }};ASSetPropFlags(MovieClip.prototype, "pauseTween", 1, 0);ASSetPropFlags(TextField.prototype, "pauseTween", 1, 0);ASSetPropFlags(Sound.prototype, "pauseTween", 1, 0);MovieClip.prototype.resumeTween = TextField.prototype.resumeTween = Sound.prototype.resumeTween = function(props) { // Resumes all tweenings currently paused for this object, unless specific property names are passed as a parameter. if (props != undefined) { if (typeof (props) == "string") props = [props]; // in case of one property, turn into array for (var i=1; i<Arguments.length; i++) props.push(Arguments[i]); } var tweenPropList = _root.__tweenController__.$_tweenPropList; var mustResume; var offsetTime; for (var pti in tweenPropList) { if (tweenPropList[pti]._targ == this && tweenPropList[pti]._isPaused) { if (props != undefined) { // Tests if it can be resumed mustResume = false; for (var i in props) { if (props[i] == tweenPropList[pti]._prop) { mustResume = true; break; } } } if (props == undefined || mustResume) { tweenPropList[pti]._isPaused = false; offsetTime = _root.__tweenController__.$_tTime - tweenPropList[pti]._timePaused; tweenPropList[pti]._timeStart += offsetTime; tweenPropList[pti]._timeDest += offsetTime; tweenPropList[pti]._timePaused = 0; } } }};ASSetPropFlags(MovieClip.prototype, "resumeTween", 1, 0);ASSetPropFlags(TextField.prototype, "resumeTween", 1, 0);ASSetPropFlags(Sound.prototype, "resumeTween", 1, 0);MovieClip.prototype.lockTween = TextField.prototype.lockTween = Sound.prototype.lockTween = function() { // Locks this object for tweening this.$_isTweenLocked = true; ASSetPropFlags(this, "this.$_isTweenLocked", 1, 0);};ASSetPropFlags(MovieClip.prototype, "lockTween", 1, 0);ASSetPropFlags(TextField.prototype, "lockTween", 1, 0);ASSetPropFlags(Sound.prototype, "lockTween", 1, 0);MovieClip.prototype.unlockTween = TextField.prototype.unlockTween = Sound.prototype.unlockTween = function() { // Unlocks this object for tweening delete (this.$_isTweenLocked);};ASSetPropFlags(MovieClip.prototype, "unlockTween", 1, 0);ASSetPropFlags(TextField.prototype, "unlockTween", 1, 0);ASSetPropFlags(Sound.prototype, "unlockTween", 1, 0);MovieClip.prototype.getTweens = TextField.prototype.getTweens = Sound.prototype.getTweens = function() { // Returns the number of tweenings actually being executed // Tweenings are NOT overwritten, so it's possible to have a series of tweenings at the same time return (this.$_tweenCount);};ASSetPropFlags(MovieClip.prototype, "getTweens", 1, 0);ASSetPropFlags(TextField.prototype, "getTweens", 1, 0);ASSetPropFlags(Sound.prototype, "getTweens", 1, 0);MovieClip.prototype.isTweening = TextField.prototype.isTweening = Sound.prototype.isTweening = function() { // Returns true if there's at least one tweening being executed, otherwise false return (this.$_tweenCount > 0 ? true : false);};ASSetPropFlags(MovieClip.prototype, "isTweening", 1, 0);ASSetPropFlags(TextField.prototype, "isTweening", 1, 0);ASSetPropFlags(Sound.prototype, "isTweening", 1, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -