当前位置:网站首页>Unity dotween sequence animation replay problem.
Unity dotween sequence animation replay problem.
2022-07-03 07:54:00 【GaoZhenwen2】
I wanted to Sequence Repeats, , The general idea is as follows :
1. First create an empty Sequence object
Sequence Squence_detail_show;2. And then in star Assign this empty object to a Dotween Of sequence object , Set up autokill by false, And the animation pauses
Squence_detail_show = DOTween.Sequence();// Create an animation sequence object .
Squence_detail_show.AppendInterval(1f);
Squence_detail_show.Append(camara_transform.DOLocalMove(new Vector3(-0.6339f, 1.2872f, -0.0463f), 2f).OnKill(()=>print(" A child object is killed ")).SetAutoKill(false));// Lens displacement 1
Squence_detail_show.Append(jia2ju4_transform_1.DOLocalMove(new Vector3(5f, 1.95f, 0), 1)); // fixture 1 an ,
Squence_detail_show.Join(jia2ju4_transform_2.DOLocalMove(new Vector3(-2.14f, 1.95f, 3.88f), 1)); // fixture 2 an ,
Squence_detail_show.Join(jia2ju4_transform_3.DOLocalMove(new Vector3(-2.08f, 1.95f, -3.65f), 1)); // fixture 3 an ,
Squence_detail_show.AppendInterval(1f);
Squence_detail_show.Append(jia2ju4_transform_1.DOLocalMove(new Vector3(2.63f, 1.95f, 0), 1)); // Return the fixture to its original position ,
Squence_detail_show.Join(jia2ju4_transform_2.DOLocalMove(new Vector3(-1.22f, 1.95f, 2.29f), 1)); // Return the fixture to its original position ,
Squence_detail_show.Join(jia2ju4_transform_3.DOLocalMove(new Vector3(-1.27f, 1.95f, -2.24f), 1)); // Return the fixture to its original position ,
/ Incremental mode of rotation , Use this all in the future
Squence_detail_show.Append(jia2zuo4_transform.DOLocalRotate(new Vector3(720, 0, 0), 1).SetRelative(true).SetEase(Ease.Linear));// The clamping seat rotates ,
Squence_detail_show.AppendInterval(1f);
Squence_detail_show.Append(camara_transform.DOLocalMove(new Vector3(-0.636f, 1.3772f, -0.1404f), 2f));// Lens displacement 2
Squence_detail_show.Append(dao1ju4jia2zuo4_transform.DOLocalMove(new Vector3(0, 0, -5), 1).SetRelative(true)); // Upper tool Clamp seat
Squence_detail_show.Append(dao1ju4jia2zuo4_transform.DOLocalMove(new Vector3(0, 0, 5), 1).SetRelative(true)); // Upper tool Clamp seat , Return action
Squence_detail_show.Append(camara_transform.DOLocalMove(Vector3_camara_main, 2f));// Lens displacement Reset
Squence_detail_show.SetEase(Ease.Linear).SetAutoKill(false).Pause().OnComplete(()=>print(" Animation 1 Play finished ")).
OnPlay(()=>print(" Animation sequence 1 Playing ."))
;
3. Use one last click Event to trigger this sequence Playback of
public void Clickde() {
if (Squence_detail_show.IsPlaying()==true)
{
print(" Wait for the mottle to play .");
return;
}
else
{
print(" Click play ");
Squence_detail_show.Play();
Squence_detail_show.PlayForward();
}
The problem is , Animation can only be played once , Try your best not to let the animation play again , I don't know what the mechanism is .
5. The final solution is , You can only play the animation once and recreate one sequence 了 , Let these animations be automatically recycled by the system , That's about it , Every quilt click Trigger and recreate a sequence.
public void Clicked() {
sequence = DOTween.Sequence();
sequence.Append(transform.DOLocalMove(new Vector3(0, 0, 4), 1).OnPlay(()=>print(" Return to the original position .")));
sequence.Append(transform.DOLocalMove(new Vector3(6, 0, 4), 1));
sequence.Append(transform.DOLocalMove(new Vector3(2, 0, 6), 1));
}If you understand , I hope you can give me some advice .
边栏推荐
- 【cocos creator】获取资源uuid
- PHP常用排序算法
- Huawei switches are configured with SSH login remote management switches
- STM32F103 SPI (pit Diary)
- Static keyword
- 华为交换机配置ssh登录远程管理交换机
- [at] ABC 258g - Triangle triples reachable - violence
- Go language foundation ------ 14 ------ gotest
- Docker installs MySQL and successfully uses Navicat connection
- 【cocos creator】点击按钮切换界面
猜你喜欢

【LeetCode】2. Valid parentheses · valid parentheses

Iterm2设置

STM32F103 SPI (pit Diary)

【LeetCode】4. Best Time to Buy and Sell Stock·股票买卖最佳时机

Go language foundation ----- 09 ----- exception handling (error, panic, recover)

Docker installs MySQL and successfully uses Navicat connection

How to configure GDAL under idea

Wechat applet taro learning record

haproxy+keepalived集群搭建02

Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
随机推荐
UA camouflage, get and post in requests carry parameters to obtain JSON format content
tp3.2和tp5.0的区别
Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)
jsutlis
Go language - loop statement
Go language foundation ----- 11 ----- regular expression
Quality blog——
Precautions for opensips and TLS SIP trunk docking
Pat class a 1028 list sorting
Wechat native applet cloud development learning record 01
华为交换机配置ssh登录远程管理交换机
Huawei switch basic configuration (telnet/ssh login)
【LeetCode】4. Best Time to Buy and Sell Stock·股票买卖最佳时机
idea取消引用显示效果
C2 several methods of merging VCF files
PAT甲级 1031 Hello World for U
E: 无法定位软件包 ros-melodic-desktop-full
输入三次猜一个数字
什麼是定義?什麼是聲明?它們有何區別?
华为交换机:配置telnet和ssh、web访问