📄 tween.as
字号:
if (objProp._propStart == undefined) objProp._propStart = 0; } else if (objProp._prop == "__special_bevel_strength__") { for (var j=0; j<objProp._targ.filters.length; j++) if (objProp._targ.filters[j] instanceof flash.filters.BevelFilter) objProp._propStart = objProp._targ.filters[j].strength; if (objProp._propStart == undefined) objProp._propStart = 1; // ...Something else (hardly) ---------------------------------------------------------------- } else { objProp._propStart = objProp._targ[objProp._prop]; } } else { // Normal cases objProp._propStart = objProp._targ[objProp._prop]; } } var endTime = objProp._timeDest + (objProp._delay*1000); if (endTime <= tTime) { // Finished, just use the end value for the last update var newValue = objProp._propDest; } else { // Continue, in-tween var newValue = _global.findTweenValue (objProp._propStart, objProp._propDest, objProp._timeStart, tTime-(objProp._delay*1000), objProp._timeDest, objProp._animType, objProp._extra1, objProp._extra2); } // sets the property value... this is done to have a 'correct' value in the target object objProp._targ[objProp._prop] = objProp._extras.mustRound ? Math.round(newValue) : newValue; // 2.26.27: option for rounded // special hard-coded case for movieclip color transformation... if (objProp._prop == "__special_mc_frame__") { objProp._targ.gotoAndStop(Math.round(newValue)); } else if (objProp._prop == "__special_mc_ra__") { new Color(objProp._targ).setTransform({ra:newValue}); } else if (objProp._prop == "__special_mc_rb__") { new Color(objProp._targ).setTransform({rb:newValue}); } else if (objProp._prop == "__special_mc_ga__") { new Color(objProp._targ).setTransform({ga:newValue}); } else if (objProp._prop == "__special_mc_gb__") { new Color(objProp._targ).setTransform({gb:newValue}); } else if (objProp._prop == "__special_mc_ba__") { new Color(objProp._targ).setTransform({ba:newValue}); } else if (objProp._prop == "__special_mc_bb__") { new Color(objProp._targ).setTransform({bb:newValue}); } else if (objProp._prop == "__special_mc_aa__") { new Color(objProp._targ).setTransform({aa:newValue}); } else if (objProp._prop == "__special_mc_ab__") { new Color(objProp._targ).setTransform({ab:newValue}); } // special hard-coded case for bezierSlideTos if (objProp._prop == "__special_bst_t__") { var extras = objProp._extras; var po = _global.findPointOnCurve (extras.__special_bst_ix__, extras.__special_bst_iy__, extras.__special_bst_cx__, extras.__special_bst_cy__, extras.__special_bst_dx__, extras.__special_bst_dy__, newValue); if (objProp._extras.mustRound) { // 2.26.27: rounded positions objProp._targ._x = Math.round(po.x); objProp._targ._y = Math.round(po.y); } else { // Normal positions objProp._targ._x = po.x; objProp._targ._y = po.y; } } // special hard-coded case for textfield color... if (typeof(objProp._targ) != "movieclip" && (objProp._prop == "__special_text_b__")) { // Special case: textfield, B value for textColor value. B being the last one to update, so also set the textfield's textColor objProp._targ.textColor = (objProp._targ.__special_text_r__ << 16) + (objProp._targ.__special_text_g__ << 8) + objProp._targ.__special_text_b__; } // special hard-coded case for sound volume... if (objProp._prop == "__special_sound_volume__") objProp._targ.setVolume(newValue); if (objProp._prop == "__special_sound_pan__") objProp._targ.setPan(newValue); // special hard-coded case for filters if (objProp._prop == "__special_blur_x__") _global.$setFilterProperty (objProp._targ, "blur_blurX", newValue, objProp._extras); if (objProp._prop == "__special_blur_y__") _global.$setFilterProperty (objProp._targ, "blur_blurY", newValue, objProp._extras); if (objProp._prop == "__special_glow_color__") _global.$setFilterProperty (objProp._targ, "glow_color", _global.findTweenColor(objProp, tTime), objProp._extras); if (objProp._prop == "__special_glow_alpha__") _global.$setFilterProperty (objProp._targ, "glow_alpha", newValue, objProp._extras); if (objProp._prop == "__special_glow_blurX__") _global.$setFilterProperty (objProp._targ, "glow_blurX", newValue, objProp._extras); if (objProp._prop == "__special_glow_blurY__") _global.$setFilterProperty (objProp._targ, "glow_blurY", newValue, objProp._extras); if (objProp._prop == "__special_glow_strength__") _global.$setFilterProperty (objProp._targ, "glow_strength", newValue, objProp._extras); if (objProp._prop == "__special_bevel_distance__") _global.$setFilterProperty (objProp._targ, "bevel_distance", newValue, objProp._extras); if (objProp._prop == "__special_bevel_angle__") _global.$setFilterProperty (objProp._targ, "bevel_angle", newValue, objProp._extras); if (objProp._prop == "__special_bevel_highlightColor__") _global.$setFilterProperty (objProp._targ, "bevel_highlightColor", _global.findTweenColor(objProp, tTime), objProp._extras); if (objProp._prop == "__special_bevel_highlightAlpha__") _global.$setFilterProperty (objProp._targ, "bevel_highlightAlpha", newValue, objProp._extras); if (objProp._prop == "__special_bevel_shadowColor__") _global.$setFilterProperty (objProp._targ, "bevel_shadowColor", _global.findTweenColor(objProp, tTime), objProp._extras); if (objProp._prop == "__special_bevel_shadowAlpha__") _global.$setFilterProperty (objProp._targ, "bevel_shadowAlpha", newValue, objProp._extras); if (objProp._prop == "__special_bevel_blurX__") _global.$setFilterProperty (objProp._targ, "bevel_blurX", newValue, objProp._extras); if (objProp._prop == "__special_bevel_blurY__") _global.$setFilterProperty (objProp._targ, "bevel_blurY", newValue, objProp._extras); if (objProp._prop == "__special_bevel_strength__") _global.$setFilterProperty (objProp._targ, "bevel_strength", newValue, objProp._extras); // 2.23.26: calls the update event, if any if (objProp._targ.onTweenUpdate != undefined) { objProp._targ.onTweenUpdate(objProp._prop); } if (endTime <= tTime) { // Past the destiny time: ended. // 2.23.26: calls the completion event, if any if (objProp._targ.onTweenComplete != undefined) { objProp._targ.onTweenComplete(objProp._prop); } _global.$stopTween (objProp._targ, [objProp._prop], false); // Removes from the tweening properties list array. So simpler than the previous versions :) // (objProp still exists so it works further on) // this.$_tweenPropList.splice(i,1); // 2.18.17 -- not needed anymore, controlled on _global.stopTween() i--; if (objProp._callback != undefined) { // Calls the _callback function if (_global.backwardCallbackTweening) { // Old style, for compatibility. // IF YOU'RE USING AN OLD VERSION AND WANT BACKWARD COMPATIBILITY, use this line: // _global.backwardCallbackTweening = true; // ON YOUR MOVIES AFTER (or before) THE #INCLUDE STATEMENT. var childMC = objProp._targ.createEmptyMovieClip("__child__", 122344); objProp._callback.apply(childMC, null); childMC.removeMovieClip(); } else { // New method for 2.12.9: use the mc scope // So simpler. I should have done this from the start... // ...instead of trying the impossible (using the scope from which the tween was called) objProp._callback.apply(objProp._targ, null); } } } } } } // Deletes the tween controller movieclip if no tweens are left if (this.$_tweenPropList.length == 0) _global.$removeTweenController();};ASSetPropFlags(_global, "$updateTween", 1, 0);_global.$stopTween = function(mtarget, props, wipeFuture) { // INTERNAL USE: Removes tweening immediately, deleting it // wipeFuture = removes future, non-executed tweenings too var tweenPropList = _root.__tweenController__.$_tweenPropList; var _prop; // Deletes it for (var pti in tweenPropList) { _prop = tweenPropList[pti]._prop; for (var i=0; i<props.length || (i<1 && props == undefined); i++) { if (tweenPropList[pti]._targ == mtarget && (_prop == props[i] || props == undefined) && (wipeFuture || tweenPropList[pti]._timeDest+(tweenPropList[pti]._delay*1000) <= getTimer())) { // Removes auxiliary vars switch (_prop) { case "__special_mc_frame__": case "__special_mc_ra__": case "__special_mc_rb__": case "__special_mc_ga__": case "__special_mc_gb__": case "__special_mc_ba__": case "__special_mc_bb__": case "__special_mc_aa__": case "__special_mc_ab__": case "__special_sound_volume__": case "__special_bst_t__": delete mtarget[_prop]; break; case "__special_text_b__": delete mtarget.__special_text_r__; delete mtarget.__special_text_g__; delete mtarget.__special_text_b__; break; } // Removes from the list tweenPropList.splice(pti, 1); } } } // Updates the tween count "cache" if (props == undefined) { delete (mtarget.$_tweenCount); } else { mtarget.$_tweenCount = 0; for (var pti in tweenPropList) { if (tweenPropList[pti]._targ == mtarget) mtarget.$_tweenCount++; } if (mtarget.$_tweenCount == 0) delete mtarget.$_tweenCount; } // Check if the tween movieclip controller should still exist if (tweenPropList.length == 0) { // No tweenings remain, remove it _global.$removeTweenController(); }};ASSetPropFlags(_global, "$stopTween", 1, 0);_global.$setFilterProperty = function(mtarget, propName, propValue, extras) { // Sets a property for a Flash 8-based filter. // This is needed because you can't modify the .filter property directly; you have to re-apply it, // and to do so in a non-destructible way (without erasing the previous filters) the array must // be cloned... var i; var applied = false; // Creates a copy of .filters var newFilters = []; for (var i=0; i<mtarget.filters.length; i++) { newFilters.push(mtarget.filters[i]); } // Finally replaces it. This looks a bit weird, I know... // I'll have to rewrite this later. I'm think which would be the best approach; this is too hardcoded. if (propName.substr(0, 5) == "blur_") { // Blur... for (i=0; i<mtarget.filters.length; i++) { if (newFilters[i] instanceof flash.filters.BlurFilter) { newFilters[i][propName.substr(5)] = propValue; if (extras.__special_blur_quality__ != undefined) newFilters[i].quality = extras.__special_blur_quality__; // Applies quality applied = true; break; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -