LeanTween 常用API

//感觉leantween和dotween 相似,不用解释了

public GameObject Cube ;

 public void 常用()
    {
       
        //物体本身大小
        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);
        //相对于父物体的位置移动
        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);
    }

// 上面是我常用的,这个有关于test的,下面曾使用api的源自于:世界太疯狂 

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using DG.Tweening;  //加入头

public class TempDoTween : MonoBehaviour {
    public GameObject m_image;

    public Text m_text;

    public Camera m_camera;

    private bool isMoveOver;

    void Awake()
    {
    }

    void Start () {
        isMoveOver = false;
        //简单移动,每次调用Do就创建一个Tweener,所以最好不要每次都创建
        Tweener tweener = m_image.transform.DOLocalMove (new Vector3(100,200,0),2);
        //设置不自动销毁
        tweener.SetAutoKill (false);
        //设置动作曲线
        tweener.SetEase (Ease.InBounce);
        //回调
        tweener.OnComplete (MoveCallback); 
        //挂起动作
        tweener.Pause ();

        //文本(文字一个个显示出来)
//        m_text.text = "";  
//        m_text.DOText ("字一个个显示出来",2).OnComplete(delegate{
//            //颜色变化
//            m_text.DOColor(Color.red,2);
//        }); //可以显示富文本查看API
        //渐渐显示出来:首先就是设置Aptha到0,值是0--1
        m_text.DOFade(1,2);

        //队列
//        Sequence mySequence = DOTween.Sequence();
//        mySequence.Append ();
//        mySequence.AppendInterval ();
//        mySequence.AppendCallback ();

        //通过ID控制得到动作

        //直接在组件上添加DoTweenAnimation脚本就是可视化的动画组件,和上面一样用法
    
        //路径编辑DoPath -->添加这个组件可以编辑路径 shit+ctrl,注意点击屏幕添加的店是与摄像机垂直,可以对路径做圆滑设置path type
    }

    public void ClickBtn()
    {
        //播放身上的动作,注意播放完成就销毁了必须SetAutoKill(false)
//        if (isMoveOver) {
//            //m_image.transform.DOPlay ();
//            m_image.transform.DOPlayForward (); //向前播放
//            isMoveOver = false;
//        } else {
//            m_image.transform.DOPlayBackwards (); //会播放和DOPlayForward成对调用
//            isMoveOver = true;
//        }
        //
        m_camera.DOShakePosition (1,new Vector3(4,4,0));
    }
    public void MoveCallback()
    {
        Debug.Log ("MoveCallBack");
    }

}
 

原文链接: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()

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

LeanTween - BZ易风 - 博客园

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
This extension requires one license per seat Requires Unity 4.6.0 or higher. Behavior trees are used by AAA studios to create a lifelike AI. With Behavior Designer, you can bring the power of behaviour trees to Unity! Behavior Designer is a behaviour tree implementation designed for everyone - programmers, artists, designers. Behavior Designer offers an intuitive visual editor with a powerful API allowing you to easily create new tasks. It also includes hundreds of tasks, PlayMaker integration, and extensive third party integ ration making it possible to create complex AIs without having to write a single line of code! Behavior Designer was designed from the ground up to be as efficient as possible with zero allocations after initialization. As a result, it runs great on all platforms including mobile. Behavior Designer is dedicated to behavior trees, which means that each update will be a better behavior tree implementation. Features: - An intuitive visual editor - A powerful API - Visual runtime debugger - Variables to communicate between tasks - Conditional Aborts - Built in event system - Unity 5 multiplayer support - Use existing code with reflection tasks - Hundreds of tasks - Evaluate tasks using Utility Theory - Realtime error detection - Binary or JSON serialization - Data-oriented design - Zero runtime allocations after startup - Object drawers (property drawers) - Includes runtime source code - Extensive documentation and videos - Sample projects available online - And more Addon Packs: - Formations Pack - Movement Pack - Tactical Pack Complete Projects: - Deathmatch AI Kit Third Party Integrations: - 2D Toolkit - A* Pathfinding Project (Movement Pack) - Adventure Creator - Anti-Cheat Toolkit - Apex Path (Movement Pack) - Blox - Camera Path Animator - Chronos - Cinema Director - Control Freak - Core GameKit - Curvy - Dialogue System - DOTween - Final IK - Glow Effect - ICode - Inventory Pro - LeanTween - Love/Hate -
This extension requires one license per seat Requires Unity 4.6.0 or higher. Behavior trees are used by AAA studios to create a lifelike AI. With Behavior Designer, you can bring the power of behavio ur trees to Unity! Behavior Designer is a behaviour tree implementation designed for everyone - programmers, artists, designers. Behavior Designer offers an intuitive visual editor with a powerful API allowing you to easily create new tasks. It also includes hundreds of tasks, PlayMaker integration, and extensive third party integration making it possible to create complex AIs without having to write a single line of code! Behavior Designer was designed from the ground up to be as efficient as possible with zero allocations after initialization. As a result, it runs great on all platforms including mobile. Behavior Designer is dedicated to behavior trees, which means that each update will be a better behavior tree implementation. Features: - An intuitive visual editor - A powerful API - Visual runtime debugger - Variables to communicate between tasks - Conditional Aborts - Built in event system - Unity 5 multiplayer support - Use existing code with reflection tasks - Hundreds of tasks - Evaluate tasks using Utility Theory - Realtime error detection - Binary or JSON serialization - Data-oriented design - Zero runtime allocations after startup - Object drawers (property drawers) - Includes runtime source code - Extensive documentation and videos - Sample projects available online - And more Addon Packs: - Formations Pack - Movement Pack - Tactical Pack Complete Projects: - Deathmatch AI Kit Third Party Integrations: - 2D Toolkit - A* Pathfinding Project (Movement Pack) - Adventure Creator - Anti-Cheat Toolkit - Apex Path (Movement Pack) - Blox - Camera Path Animator - Chronos - Cinema Director - Control Freak - Core GameKit - Curvy - Dialogue System - DOTween - Final IK - Glow Effect - ICode - Inventory Pro - LeanTween - Love/Hate - Master Audio - NGUI - Partic
leantween是一款用于Unity游戏引擎的插件,可以帮助开发者在游戏中实现各种动画效果。然而,leantween低版本存在一些限制和问题,导致无法正常使用。 首先,leantween低版本可能不支持最新的Unity版本。Unity引擎在不断更新和改进,每个版本之间都会有一些API的变动和更新。如果leantween的低版本没有相应地进行适配和更新,则可能无法与最新的Unity版本兼容,无法正常使用。 其次,leantween低版本可能存在一些Bug和稳定性问题。随着时间的推移,开发者会不断发现并修复leantween插件中的问题。这些修复通常会在新的版本中发布,而低版本则可能没有得到修复。因此,如果使用leantween的低版本,可能会遇到一些已知的问题,这会影响开发者的工作效率和游戏的质量。 最后,leantween低版本缺少一些新功能和改进。随着时间的推移,leantween可能会添加新的功能、优化性能并改进用户体验。这些功能和改进通常会在新版本中发布,而低版本则无法享受到这些新特性。如果开发者想要使用最新的功能,提高开发效率或者改进游戏的动画效果,那么必须使用leantween的较新版本。 综上所述,leantween低版本由于不支持最新的Unity版本、存在Bug和稳定性问题以及缺少新功能和改进,所以无法正常使用。为了保证开发效率和游戏质量,开发者应尽量使用leantween的较新版本。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值