public void AddTimeline(TransformTimeline timeline, string timelineName) { if(timeline == null) { throw new ArgumentException(); } _timelines[timelineName] = timeline; }
public void AddTimeline(TransformTimeline timeline, string timelineName) { if (timeline == null) { throw new ArgumentException(); } _timelines[timelineName] = timeline; }
private static TransformTimeline parseTransformTimeline(Dictionary <String,Object> timelineObject,float duration,uint frameRate) { TransformTimeline timeline = new TransformTimeline(); timeline.Duration = duration; parseTimeline(timelineObject,timeline,parseTransformFrame,frameRate); timeline.Scale = (float)timelineObject[ConstValues.A_SCALE]; timeline.Offset = (float)timelineObject[ConstValues.A_OFFSET]; return(timeline); }
public static void GetTimelineTransform(TransformTimeline timeline, float position, DBTransform retult) { List<Frame> frameList = timeline.FrameList; int i = frameList.Count; TransformFrame currentFrame; float tweenEasing; float progress; TransformFrame nextFrame; while(i -- >0) { currentFrame = frameList[i] as TransformFrame; if(currentFrame.Position <= position && currentFrame.Position + currentFrame.Duration > position) { tweenEasing = currentFrame.TweenEasing; if(i == frameList.Count - 1 || float.IsNaN(tweenEasing) || position == currentFrame.Position) { retult.Copy(currentFrame.Global); } else { progress = (position - currentFrame.Position) / currentFrame.Duration; if(tweenEasing!=0&&!float.IsNaN(tweenEasing)) { progress = TimelineState.GetEaseValue(progress, tweenEasing); } nextFrame = frameList[i + 1] as TransformFrame; retult.X = currentFrame.Global.X + (nextFrame.Global.X - currentFrame.Global.X) * progress; retult.Y = currentFrame.Global.Y + (nextFrame.Global.Y - currentFrame.Global.Y) * progress; retult.SkewX = TransformUtil.FormatRadian(currentFrame.Global.SkewX + (nextFrame.Global.SkewX - currentFrame.Global.SkewX) * progress); retult.SkewY = TransformUtil.FormatRadian(currentFrame.Global.SkewY + (nextFrame.Global.SkewY - currentFrame.Global.SkewY) * progress); retult.ScaleX = currentFrame.Global.ScaleX + (nextFrame.Global.ScaleX - currentFrame.Global.ScaleX) * progress; retult.ScaleY = currentFrame.Global.ScaleY + (nextFrame.Global.ScaleY - currentFrame.Global.ScaleY) * progress; } break; } } }
private static TransformTimeline parseTransformTimeline(Dictionary<String, Object> timelineObject, float duration, uint frameRate) { TransformTimeline timeline = new TransformTimeline(); timeline.Duration = duration; parseTimeline(timelineObject, timeline, parseTransformFrame, frameRate); timeline.Scale = (float)timelineObject[ConstValues.A_SCALE]; timeline.Offset = (float)timelineObject[ConstValues.A_OFFSET]; return timeline; }
private void clearVaribles() { _updateState = 0; _bone = null; _animationState = null; _timeline = null; _currentFrame = null; _originTransform = null; _originPivot = null; }
public void FadeIn(Bone bone, AnimationState animationState, TransformTimeline timeline) { _bone = bone; _animationState = animationState; _timeline = timeline; _originTransform = _timeline.OriginTransform; _originPivot = _timeline.OriginPivot; //_originTransform.copy(_timeline.originTransform); /* var bLRX:Number = _bone.origin.skewX + _bone.offset.skewX + _bone._tween.skewX; var bLRY:Number = _bone.origin.skewY + _bone.offset.skewY + _bone._tween.skewY; _originTransform.skewX = bLRX + TransformUtils.formatRadian(_originTransform.skewX - bLRX); _originTransform.skewY = bLRY + TransformUtils.formatRadian(_originTransform.skewY - bLRY); */ _tweenTransform = false; _tweenColor = false; _totalTime = _animationState.TotalTime; Transform.X = 0; Transform.Y = 0; Transform.ScaleX = 0; Transform.ScaleY = 0; Transform.SkewX = 0; Transform.SkewY = 0; Pivot.X = 0; Pivot.Y = 0; _durationTransform.X = 0; _durationTransform.Y = 0; _durationTransform.ScaleX = 0; _durationTransform.ScaleY = 0; _durationTransform.SkewX = 0; _durationTransform.SkewY = 0; _durationPivot.X = 0; _durationPivot.Y = 0; _currentFrame = null; switch(_timeline.FrameList.Count) { case 0: _bone.arriveAtFrame(null, this, _animationState, false); _updateState = 0; break; case 1: _updateState = -1; break; default: _updateState = 1; break; } }