以下內容為之前在公司分享的東西
目前專案使用的Tween System
為何要使用DOTween
https://dotween.demigiant.com/index.php
2016年10月左右開始使用
優點:
缺點:
個人比較在乎的
Not only very fast, but also very efficient: everything is cached and reused to avoid useless GC allocations.
Shortcut extensions that directly extend common objects like this: // Move a transform to position 1,2,3 in 1 second transform.DOMove(new Vector3(1,2,3), 1);
Play, Pause, Rewind, Restart, Complete, Goto and tons of other useful methods to control your tweens.
其他見 https://dotween.demigiant.com/index.php#features
Transform
Material
Camera
通用方法
// Tween a Vector3 called myVector to 3,4,8 in 1 second
DOTween.To(()=> myVector, x=> myVector = x, new Vector3(3,4,8), 1);

幾乎可以應付所有狀況的callback可以使用
這裡列出幾個比較常用的選項
漸進的設置
設置一個獨特的id, 以便以後取用
播放次數
設置該tween要在Update, FixedUpdate, LateUpdate處理
延遲時間
以單位時間為基準, 打開後設置的時間會變成每單位的時間。
比方說DOMove(4, 1)原本是一秒移動4單位,會變成一秒移動一單位, 移動4秒。
官方測試 https://dotween.demigiant.com/#enginesComparison
個人喜歡他的DoPath會有預覽線條的功能。