zoukankan      html  css  js  c++  java
  • DoTween联合动画Sequence的使用

    Sequence的几个方法:

    Append(Tween tween)

    在Sequence的最后添加一个tween。

    AppendCallback(TweenCallback callback)

    在Sequence的最后添加一个回调函数。

    AppendInterval(float interval)

    在Sequence的最后添加一段时间间隔。

    Insert(float atPosition,Tween tween)

    在给定的时间位置上放置一个tween,可以实现同时播放多个tween的效果,而不是一个接一个播放。

    InsertCallback(float atPosition, TweenCallback callback)

    在给定的时间位置上放置一个回调函数。

    Join(Tween tween)

    在Sequence的最后一个tween的开始处放置一个tween。可以实现同时播放多个tween的效果,而不是一个接一个播放。

    Prepend(Tween tween)

    在Sequence开始处插入一个tween,原先的内容根据时间往后移。

    PrependCallback(TweenCallback callback)

    在Sequence开始处插入一个回调函数。

    PrependInterval(float interval)

    在Sequence开始处插入一段时间间隔,原先的内容根据时间往后移。

    Sequence的一个简单例子:

    private Text mText;
    
    public float duration = 1;
    public Vector3 scaleEnd = Vector3.one;
    public Color colorEnd = Color.red;
    
    private Sequence mSequence;
    
    private void Awake()
    {
        mText = GetComponent<Text>();
        mSequence = DOTween.Sequence();
        mSequence.Append(transform.DOScale(scaleEnd, duration));
        mSequence.Join(mText.DOColor(colorEnd, duration));
        mSequence.SetAutoKill(false);
        mSequence.Pause();
    }
    
    private void Update()
    {
        if (Input.GetKeyUp(KeyCode.O))
        {
            PlayForward();
        }
        else if (Input.GetKeyUp(KeyCode.P))
        {
            PlayBackWard();
        }
    }
    
    public void PlayForward()
    {
        mSequence.PlayForward();
    }
    public void PlayBackWard()
    {
        mSequence.PlayBackwards();
    }
  • 相关阅读:
    Fiddler 教程
    Snippet Compiler——代码段编译工具
    HTML5 Audio时代的MIDI音乐文件播放
    sql 数据库 庞大数据量 需要分表
    使用LINQ查询非泛型类型
    找出numpy array数组的最值及其索引
    list的*运算使用过程中遇到的问题
    4.keras实现-->生成式深度学习之用GAN生成图像
    np.repeat 与 np.tile
    pandas中的axis=0,axis=1,傻傻分不清楚
  • 原文地址:https://www.cnblogs.com/luoyanghao/p/11220407.html
Copyright © 2011-2022 走看看