コード例 #1
0
		public void AddTimeline(TransformTimeline timeline, string timelineName)
		{
			if(timeline == null)
			{
				throw new ArgumentException();
			}

			_timelines[timelineName] = timeline;
		}
コード例 #2
0
        public void AddTimeline(TransformTimeline timeline, string timelineName)
        {
            if (timeline == null)
            {
                throw new ArgumentException();
            }

            _timelines[timelineName] = timeline;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
		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;
				}
			}
		}
コード例 #5
0
		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;
		}
コード例 #6
0
		private void clearVaribles()
		{
			_updateState = 0;
			_bone = null;
			_animationState = null;
			_timeline = null;
			_currentFrame = null;
			_originTransform = null;
			_originPivot = null;
		}
コード例 #7
0
		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;
			}
		}