BZ易风

导航

 

原文链接:https://blog.csdn.net/qq_35373690/article/details/86901002

物体本身大小 LeanTween.scale(Cube, new Vector3(0, 0, 0), 0.5f);

//3个参数1.变换的物体,2变化的大小,3.时间

//物体旋转角度(自身角度)

LeanTween.rotate(Cube, new Vector3(0, 0, 0), 0.5f);


//相对于父物体的角度
LeanTween.rotateLocal(Cube, new Vector3(0, 0, 0), 0.5f);

物体位置移动(自身角度)

LeanTween.move(Cube, new Vector3(0, 0, 0), 0.5f);

setEase()  //设置动画

动画类型:LeanTweenType

 

 自定义动画类型

public AnimationCurve myCur;

void MoveCube()
{
    LeanTween.move(cube.gameObejct, new Vector3(0f,10f,0f),0.5f).setEase(myCur);  //Unity中设置关键帧
}

来回循环:setPingPong()

LeanTween.move(cube.gameObejct, new Vector3(0f,10f,0f),0.5f).setPingPong();

设置委托:setOnComplete()

using...
public class Test:Monobehaviout{
    public AnimationCurve myCur;
 
    void MoveCube(Active active)
    {
        LeanTween.move(cube.gameObejct, new Vector3(0f,10f,0f),0.5f)
      .setEase(myCur)  //Unity中设置关键帧
      
      .setOnComplete(
        (delegate(){
            active();
        })          //委托
        .setLoopPingPong();    //来回循环;              
    }
    
    void Start()
    {
        MoveCube(RandomColor);
    }

    void RandomColor()
    {
      this.gameObject.GetComponent<Renderer>().material.color=
      new Color(UnityEngine.Random.Range(0f,1f),
                     UnityEngine.Random.Range(0f,1f),
                     UnityEngine.Random.Range(0f,1f))  //改变颜色
    }    

设置更新:setOnUpdate()

监听数值变化,当达到一定值的时候可以让它触发个事件

 


//相对于父物体的位置移动
LeanTween.moveLocal(Cube, new Vector3(0, 0, 0), 0.5f);
//颜色修改
LeanTween.color(Cube, new Color(0,0,0,0), 0.5f);
//UI颜色修改
LeanTween.color(Cube.GetComponent<RectTransform>(), new Color(0, 0, 0, 0), 0.5f);

//渐渐显示出来:首先就是设置Aptha到0,值是0--1
Cube .DOFade(1,2);
//取消

LeanTween.cancelAll()

posted on 2021-08-12 15:09  BZ易风  阅读(1023)  评论(0编辑  收藏  举报