The animation curve Unity

The animation curve Unity

Animation Curves on Imported Clips

Animation curve may be attached to import video clips animation tab disposed in animations into.

These curves allow you to add additional data to the movie clips to import, which allows you to animation time other items according to the state animator. For example, in a game under ice-cooling conditions, additional animation curve may be used to control the transmission rate of the particle system, in order to display the player is condensed in the cold air of respiration.

To first selected animation file imported in the project view add import animation curve, the animation and select button provided in the lead inspector.

Expand curves title, then click the plus icon to add a new curve to the current video clip. If the imported movie file is divided into a plurality of movie segments, each segment can have its own custom curve.

Expand the curve heading, then click the plus icon to add a new curve to the current video clip. If the imported movie file is divided into a plurality of movie segments, each segment can have its own custom curve.
X axis represents a normalized time profile, and always between 0.0 and 1.0 (respectively corresponding to the start and end of a video clip, regardless of its duration).
Here Insert Picture Description
Here Insert Picture Description
Import animation curves

Create a key point : Double left click

Delete key points:

** (1) ** mouse to move the key, right -> Delete Key.

** (2) ** Left-click the key, and then press delete on your keyboard

Curve Type Set **: ** mouse to move the key, right ->

** Auto: ** key is automatically set in accordance with the curve.

** Free Smooth: ** a unified set out tangents and tangent

** Flat: ** tangents and tangent to the level

** Broken: ** tangents are provided and the tangent
may be selected from the Left Tangent (tangent) or Right Tangent (the tangent) or Both Tangents (two tangents).

** Free: ** scribbles, and Broken essentially the same effect.

** Linear: ** linear curve

** Constant: Before ** has been a value on the points, and then instantly becomes the value of the point.
The simplest among Auto, Broken adjust the maximum space. Curve effect green line prevail.

** Loop: ** Pattern cycles

Pingpong: curve after inversion cycle curves and the curve up and down

** Clamp: ** up to the value of the endpoint.
code show as below


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Curve : MonoBehaviour
{
    public AnimationCurve animationCurve;
    public Vector3 v3;
    // Start is called before the first frame update
    void Start()
    {
        v3 = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = new Vector3(Time.time+v3.x, animationCurve.Evaluate(Time.time)+v3.y, v3.z);
    }
}


Here Insert Picture DescriptionThe script will be mounted in accordance with the movement of the curve you want to set your object.

Guess you like

Origin blog.csdn.net/weixin_44370124/article/details/90812762