public override void ProcessFrame(Playable playable, FrameData info, object playerData) { float duration = (float)playable.GetDuration(); float passedTime = (float)playable.GetTime(); Debug.Log("Playable get time " + playable.GetTime()); Debug.Log("Playable duration " + playable.GetDuration()); float t = duration - passedTime; Vector3 change = position - initialPosition; trasnform.position = Equations.ChangeVector(t, position, change, duration, Ease.Linear); }
protected override void EvaluteAtTime(float t) { if (rect != null) { Vector3 change = startPosition - endPosition; Vector3 targetPosition = Equations.ChangeVector(t, endPosition, change, duration, ease); if (!useCustomPivot) { rect.anchoredPosition = rect.FromAbsolutePositionToAnchoredPosition(targetPosition, canvas, pivotPreset); } else { rect.anchoredPosition = rect.FromAbsolutePositionToAnchoredPosition(targetPosition, canvas, pivot); } } }
//Update Rotation private void UpdateRotation(TweenRotationObject tween) { Vector3 begin = tween.startValue; Vector3 finish = tween.tweenValue; Vector3 change = finish - begin; float duration = tween.totalTime; float currentTime = Time.time - (tween.startTime + tween.delay); if (duration == 0) { this.EndTween(tween); this.transform.position = finish; return; } if (Time.time > tween.startTime + tween.delay + duration) { this.EndTween(tween); } this.transform.rotation = Quaternion.Euler(Equations.ChangeVector(currentTime, begin, change, duration, tween.ease)); }
public void EvaluateAtTime(float t) { t *= Length; int index = GetIndexAtTime(t); Debug.Log("index: " + index); float distanceToNextNode = Vector2.Distance(m_processedPath[index], m_processedPath[index + 1]); float passTime = 0.0f; for (int n = 0; n < index; n++) { passTime += m_pathTime[n]; } t -= passTime; Vector3 change = m_processedPath[index + 1] - m_processedPath[index]; m_rect.anchoredPosition = Equations.ChangeVector(t, m_processedPath[index], change, (distanceToNextNode / m_totalPathDistance) * m_length, m_ease); }