Example #1
0
    public static float Evaluate(this ObjectAnimator.CurveType curve, float t)
    {
        switch (curve)
        {
        case ObjectAnimator.CurveType.EaseIn:
            return(1f - Mathf.Cos((float)((double)t * 3.14159274101257 * 0.5)));

        case ObjectAnimator.CurveType.EaseOut:
            return(Mathf.Cos((float)((1.0 - (double)t) * 3.14159274101257 * 0.5)));

        case ObjectAnimator.CurveType.EaseInOut:
            return((float)((1.0 - (double)Mathf.Cos(t * 3.141593f)) * 0.5));

        default:
            return(t);
        }
    }
Example #2
0
 public void ScaleTo(Vector3 scale, float duration, ObjectAnimator.CurveType curveType)
 {
     this.mPositionSet = false;
     this.mRotationSet = false;
     this.mScaleSet    = true;
     this.mTime        = 0.0f;
     if ((double)duration > 0.0)
     {
         this.mStartScale = ((Component)this).get_transform().get_localScale();
         this.mEndScale   = scale;
         this.mCurve      = (AnimationCurve)null;
         this.mCurveType  = curveType;
         this.mDuration   = duration;
     }
     else
     {
         ((Component)this).get_transform().set_localScale(scale);
         this.mDuration = 0.0f;
     }
     ((Behaviour)this).set_enabled(true);
 }
Example #3
0
 public void AnimateTo(Vector3 position, Quaternion rotation, float duration, ObjectAnimator.CurveType curveType)
 {
     this.mPositionSet = true;
     this.mRotationSet = true;
     this.mScaleSet    = false;
     this.mTime        = 0.0f;
     if ((double)duration > 0.0)
     {
         this.mStartPos  = ((Component)this).get_transform().get_position();
         this.mStartRot  = ((Component)this).get_transform().get_rotation();
         this.mEndPos    = position;
         this.mEndRot    = rotation;
         this.mCurve     = (AnimationCurve)null;
         this.mCurveType = curveType;
         this.mDuration  = duration;
     }
     else
     {
         ((Component)this).get_transform().set_position(position);
         ((Component)this).get_transform().set_rotation(rotation);
         this.mDuration = 0.0f;
     }
     ((Behaviour)this).set_enabled(true);
 }