Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
165 lines (97 sloc) 3.14 KB

Animate

Fade

Note: For fade animations to work you need to have materials with a blend mode of fade.

Note: 100% alpha is relative to each GameObject's initial alpha value. This is to prevent materials with custom alpha values from being reset.

Fade a GameObject from 0% to 100% with a duration of 1s.

CandyCoded.Animate.Fade(gameObject, 0, 1, 1);

Fade a GameObject from 100% to 0% with a duration of 1s.

CandyCoded.Animate.Fade(gameObject, 1, 0, 1);

Fade a GameObject with a custom AnimationCurve.

public AnimationCurve animationCurve;

private void Start() {

    CandyCoded.Animate.Fade(gameObject, animationCurve);

}

MoveTo

Move a GameObject to a new Vector3 with a duration of 1s.

CandyCoded.Animate.MoveTo(gameObject, new Vector3(10, 10, 10), 1);

Move an object in world space.

CandyCoded.Animate.MoveTo(gameObject, new Vector3(10, 10, 10), 1, Space.World);

Position

Move GameObject with a custom Vector3AnimationCurve.

public CandyCoded.Vector3AnimationCurve animationCurve;

private void Start() {

    CandyCoded.Animate.Position(gameObject, animationCurve);

}

PositionRelative

Move GameObject, relative to it's original position, with a custom Vector3AnimationCurve.

public CandyCoded.Vector3AnimationCurve animationCurve;

private void Start() {

    CandyCoded.Animate.PositionRelative(gameObject, animationCurve);

}

RotateTo

Rotate a GameObject to a new Vector3 with a duration of 1s.

CandyCoded.Animate.RotateTo(gameObject, new Vector3(360, 0, 0), 1);

Rotation

Rotate GameObject with a custom Vector3AnimationCurve.

public CandyCoded.Vector3AnimationCurve animationCurve;

private void Start() {

    CandyCoded.Animate.Rotation(gameObject, animationCurve);

}

Scale

Scale GameObject with a custom Vector3AnimationCurve.

public CandyCoded.Vector3AnimationCurve animationCurve;

private void Start() {

    CandyCoded.Animate.Scale(gameObject, animationCurve);

}

ScaleTo

Scale a GameObject to a new Vector3 with a duration of 1s.

CandyCoded.Animate.ScaleTo(gameObject, new Vector3(2, 2, 2), 1);

ScaleRelative

Scale GameObject, relative to it's original scale, with a custom Vector3AnimationCurve.

public CandyCoded.Vector3AnimationCurve animationCurve;

private void Start() {

    CandyCoded.Animate.ScaleRelative(gameObject, animationCurve);

}

Stop

Stop animation attached to a GameObject by name.

private void Start() {

    CandyCoded.Animate.Stop(gameObject, "Fade");

}

StopAll

Stops all animations attached to a GameObject.

private void Start() {

    CandyCoded.Animate.StopAll(gameObject);

}
You can’t perform that action at this time.