00001 import gugga.animations.MaskAnimationTypes;
00002 import gugga.animations.MotionDirections;
00003 import gugga.animations.MotionTypes;
00004 import gugga.animations.PropertiesTweenAnimationType;
00005 import gugga.animations.ScrollRectAnimation;
00006
00010 class gugga.animations.ScrollRectLinedAnimation extends ScrollRectAnimation
00011 {
00012 private var mLine : MovieClip;
00013 public function get Line() : MovieClip { return mLine; }
00014 public function set Line(aValue:MovieClip) : Void { mLine = aValue; }
00015
00016 private var mLineToEdgeOffset : Number = 0;
00017 public function get LineToEdgeOffset() : Number { return mLineToEdgeOffset; }
00018 public function set LineToEdgeOffset(aValue:Number) : Void { mLineToEdgeOffset = aValue; }
00019
00020 function ScrollRectLinedAnimation(aSubject : MovieClip, aType : MaskAnimationTypes, aDirection : MotionDirections, aMotionType : MotionTypes)
00021 {
00022 super(aSubject, aType, aDirection, aMotionType);
00023 }
00024
00025 private function onTweenUpdated(ev) : Void
00026 {
00027 super.onTweenUpdated(ev);
00028
00029 if (mDirection == MotionDirections.Down ||
00030 mDirection == MotionDirections.DownLeft ||
00031 mDirection == MotionDirections.DownRight)
00032 {
00033 mLine._y = mSubject._y - mLine._height - mLineToEdgeOffset;
00034 }
00035
00036 if (mDirection == MotionDirections.Up ||
00037 mDirection == MotionDirections.UpLeft ||
00038 mDirection == MotionDirections.UpRight)
00039 {
00040 mLine._y = mSubject._y + mScrollRect.height + mLine._height + mLineToEdgeOffset;
00041 }
00042
00043 if (mDirection == MotionDirections.Right ||
00044 mDirection == MotionDirections.UpRight ||
00045 mDirection == MotionDirections.DownRight)
00046 {
00047 mLine._x = mSubject._x - mLine._width - mLineToEdgeOffset;
00048 }
00049
00050 if (mDirection == MotionDirections.Left ||
00051 mDirection == MotionDirections.UpLeft ||
00052 mDirection == MotionDirections.DownLeft)
00053 {
00054 mLine._x = mSubject._x + mScrollRect.width + mLine._width + mLineToEdgeOffset;
00055 }
00056 }
00057
00058 public static function createWipeInFrameAnimation(aDirection : MotionDirections,
00059 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00060 {
00061 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Wipe,
00062 aDirection, MotionTypes.In);
00063
00064 result.TweenType = PropertiesTweenAnimationType.FrameTween;
00065 applyAdditionalProperties(result, aTime, aEasingType);
00066
00067 return result;
00068 }
00069
00070 public static function createWipeOutFrameAnimation(aDirection : MotionDirections,
00071 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00072 {
00073 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Wipe,
00074 aDirection, MotionTypes.Out);
00075
00076 result.TweenType = PropertiesTweenAnimationType.FrameTween;
00077 applyAdditionalProperties(result, aTime, aEasingType);
00078
00079 return result;
00080 }
00081
00082 public static function createFlyInFrameAnimation(aDirection : MotionDirections,
00083 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00084 {
00085 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Fly,
00086 aDirection, MotionTypes.In);
00087
00088 result.TweenType = PropertiesTweenAnimationType.FrameTween;
00089 applyAdditionalProperties(result, aTime, aEasingType);
00090
00091 return result;
00092 }
00093
00094 public static function createFlyOutFrameAnimation(aDirection : MotionDirections,
00095 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00096 {
00097 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Fly,
00098 aDirection, MotionTypes.Out);
00099
00100 result.TweenType = PropertiesTweenAnimationType.FrameTween;
00101 applyAdditionalProperties(result, aTime, aEasingType);
00102
00103 return result;
00104 }
00105
00106 public static function createWipeInTimeAnimation(aDirection : MotionDirections,
00107 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00108 {
00109 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Wipe,
00110 aDirection, MotionTypes.In);
00111
00112 result.TweenType = PropertiesTweenAnimationType.TimeTween;
00113 applyAdditionalProperties(result, aTime, aEasingType);
00114
00115 return result;
00116 }
00117
00118 public static function createWipeOutTimeAnimation(aDirection : MotionDirections,
00119 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00120 {
00121 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Wipe,
00122 aDirection, MotionTypes.Out);
00123
00124 result.TweenType = PropertiesTweenAnimationType.TimeTween;
00125 applyAdditionalProperties(result, aTime, aEasingType);
00126
00127 return result;
00128 }
00129
00130 public static function createFlyInTimeAnimation(aDirection : MotionDirections,
00131 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00132 {
00133 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Fly,
00134 aDirection, MotionTypes.In);
00135
00136 result.TweenType = PropertiesTweenAnimationType.TimeTween;
00137 applyAdditionalProperties(result, aTime, aEasingType);
00138
00139 return result;
00140 }
00141
00142 public static function createFlyOutTimeAnimation(aDirection : MotionDirections,
00143 aTarget : MovieClip, aTime : Number, aEasingType : Function) : ScrollRectLinedAnimation
00144 {
00145 var result : ScrollRectLinedAnimation = new ScrollRectLinedAnimation(aTarget, MaskAnimationTypes.Fly,
00146 aDirection, MotionTypes.Out);
00147
00148 result.TweenType = PropertiesTweenAnimationType.TimeTween;
00149 applyAdditionalProperties(result, aTime, aEasingType);
00150
00151 return result;
00152 }
00153
00154 }