public TweenData_Transform_Transform(Transform inTransform, Transform inTarget, Space inSpace, TransformProperties inProperties)
 {
     m_Transform  = inTransform;
     m_Target     = inTarget;
     m_Properties = inProperties;
     m_End        = new TransformState(inTarget, inSpace);
 }
Esempio n. 2
0
        /// <summary>
        /// Snaps this transform's properties to those on the given transform.
        /// </summary>
        static public void SnapTo(this Transform inTransform, Transform inTarget, TransformProperties inProperties = TransformProperties.All, Space inSpace = Space.World)
        {
            TransformState state = (inSpace == Space.World ? TransformState.WorldState() : TransformState.LocalState());

            state.Refresh(inTarget, inProperties);
            state.Apply(inTransform, inProperties);
        }
 public void OnTweenStart()
 {
     m_Start = new TransformState(m_Transform, m_End.Space);
     if ((m_Properties & TransformProperties.Rotation) != 0)
     {
         EulerStorage.AddTransform(m_Transform);
         m_RecordID = m_Transform.GetInstanceID();
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Interpolates betwen two TransformStates.
        /// </summary>
        static public void Lerp(ref TransformState outNewState, TransformState inStateA, TransformState inStateB, float inPercent)
        {
            if (inStateA.m_Space != inStateB.m_Space)
            {
                throw new InvalidOperationException("Cannot interpolate between world and self space TransformStates!");
            }

            outNewState.m_Position = Vector3.LerpUnclamped(inStateA.m_Position, inStateB.m_Position, inPercent);
            outNewState.m_Scale    = Vector3.LerpUnclamped(inStateA.m_Scale, inStateB.m_Scale, inPercent);
            outNewState.m_Rotation = Quaternion.SlerpUnclamped(inStateA.Rotation, inStateB.Rotation, inPercent).eulerAngles;
            outNewState.m_Space    = inStateA.m_Space;
        }
Esempio n. 5
0
        /// <summary>
        /// Interpolates betwen two TransformStates.
        /// </summary>
        static public TransformState Lerp(TransformState inStateA, TransformState inStateB, float inPercent)
        {
            if (inStateA.m_Space != inStateB.m_Space)
            {
                throw new InvalidOperationException("Cannot interpolate between world and self space TransformStates!");
            }

            TransformState newState = new TransformState();

            newState.m_Position = Vector3.LerpUnclamped(inStateA.m_Position, inStateB.m_Position, inPercent);
            newState.m_Scale    = Vector3.LerpUnclamped(inStateA.m_Scale, inStateB.m_Scale, inPercent);
            newState.m_Rotation = Quaternion.SlerpUnclamped(inStateA.Rotation, inStateB.Rotation, inPercent).eulerAngles;
            newState.m_Space    = inStateA.m_Space;
            return(newState);
        }
 /// <summary>
 /// Transforms the Transform to another Transform over time.
 /// </summary>
 static public Tween TransformTo(this Transform inTransform, TransformState inTarget, TweenSettings inSettings, TransformProperties inProperties = TransformProperties.All)
 {
     return(Tween.Create(new TweenData_Transform_TransformState(inTransform, inTarget, inProperties), inSettings));
 }
 public void ApplyTween(float inPercent)
 {
     m_End.Refresh(m_Target, m_Properties);
     TransformState.Lerp(ref m_Current, m_Start, m_End, inPercent);
     m_Current.Apply(m_Transform, m_Properties);
 }
 public TweenData_Transform_TransformState(Transform inTransform, TransformState inTarget, TransformProperties inProperties)
 {
     m_Transform  = inTransform;
     m_Target     = inTarget;
     m_Properties = inProperties;
 }
Esempio n. 9
0
 public void ApplyTween(float inPercent)
 {
     TransformState.Lerp(m_Start, m_Target, inPercent).Apply(m_Transform, m_Properties);
 }