Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 |
/********************************************************************** Copyright : (c) 2006-2007 Scaleform Corp. All Rights Reserved. Portions of the integration code is from Epic Games as identified by Perforce annotations. Copyright 2010 Epic Games, Inc. All rights reserved. Licensees may use this file in accordance with the valid Scaleform Commercial License Agreement provided with the software. This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR ANY PURPOSE. **********************************************************************/ /** * Base class for a GFxMoviePlayer with a TweenManager. * Workaround for lack of multiple inheritance. */ class UTGFxTweenableMoviePlayer extends GFxMoviePlayer; enum TweenType { TWEEN_EaseOut, TWEEN_EaseIn, TWEEN_Linear }; struct GFxTween { var GFxObject TargetMC; var float TweenTime; var float Duration, StartValue, Delta, DesiredValue; var string MemberName; var string Callback; var ASDisplayInfo displayInfo; var bool bFinished; var TweenType ThisTweenType; }; var array<GFxTween> TweenList; /* * Create a new tween on a GFxObject. * * mc: Target GFxObject to tween. * duration: Duration of tween. * member: A number member of GFxObject to tween (ie. "_z"). * target: A float that, when reached, triggers the tween stop. * tweenClass: The type of tween (EaseOut, EaseIn, Linear). * callback: Data which can be used by the class which instaniated the tween to trigger a subsequent event. */ function TweenTo(GFxObject mc, float duration, String member, float target, TweenType NewTweenType, optional String callback = "") { local GFxTween Tween; Tween.TargetMC = mc; Tween.Duration = Duration; Tween.MemberName = member; Tween.DesiredValue = target; Tween.StartValue = mc.GetFloat(member); Tween.Callback = Callback; Tween.ThisTweenType = NewTweenType; TweenList[TweenList.Length] = Tween; } function ProcessTweenCallback(String Callback, GFxObject TargetMC); /* * Iterate through managed tweens and update each. */ function Tick(Float deltaTime) { local int i; local float pos, CurrentValue; for ( i=0; i<TweenList.Length; i++ ) { if (!TweenList[i].bFinished) { TweenList[i].TweenTime += DeltaTime; pos = TweenList[i].TweenTime/TweenList[i].Duration; switch(TweenList[i].ThisTweenType) { case TWEEN_EaseIn: pos = pos*pos*pos; case TWEEN_EaseOut: pos = pos - 1; pos = (pos * pos * pos) + 1; case TWEEN_Linear: break; default: pos = 1.0; break; } CurrentValue = (TweenList[i].DesiredValue - TweenList[i].StartValue) * pos + TweenList[i].StartValue; TweenList[i].TargetMC.SetFloat(TweenList[i].MemberName, CurrentValue); if (pos > 1.0) { TweenList[i].bFinished = true; TweenComplete(i); } } } } /* * Remove all existing tweens on target MovieClip. * * mc: Target GFxObject. * bReset: If true, MovieClip immediately reverts to original position. * If false, MovieClip tweens back to original position. */ function ClearsTweensOnMovieClip(GFxObject mc, optional bool bReset = TRUE) { local int i; local GFxTween Item; for ( i=0; i<TweenList.Length; i++ ) { Item = TweenList[i]; if (Item.TargetMC == mc) { Item.bFinished = true; if (bReset) { Item.TargetMC.SetFloat(Item.MemberName, Item.StartValue); } TweenList.Remove(i,1); } } } /* * Print a list of existing managed tweens to the log. * Used for debugging. */ function PrintTweensToLog() { local int i; for ( i=0; i<TweenList.Length; i++ ) `Log(i @ TweenList[i].ThisTweenType); } /* * When a managed tween is finished, it fires a callback to this function. * Pass the tween's callback to ProcessTweenCallback() and delete * the tween. */ function TweenComplete(int index) { ProcessTweenCallback(TweenList[index].Callback, TweenList[index].TargetMC); TweenList.Remove(index,1); } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |