当前位置:网站首页>Dotween usage
Dotween usage
2022-06-11 10:01:00 【weixin_ forty-three million seven hundred and fifty-four thousa】
Create a Tweener It's its own coordinates One second Move to coordinate Vector3(5, 5, 5) Location
Tween tween = DOTween.To(() => transform.position, r => transform.position = r, new Vector3(5, 5, 5), 1);
Create a Tweener object , another number The value of the 5 It changes to 100
Tween t = DOTween.To(() => number, x => number = x, 100, 5)
To carry out t When the change , One callback per frame UpdateTween Method
t.OnUpdate( () => UpdateTween(number));
// Ten seconds X,Y,Z Local coordinates (localPosition) Move to 10,10,10 Location
//transform.DOBlendableLocalMoveBy(new Vector3(10, 10, 10), 10);
// Ten seconds X,Y,Z Local rotation of direction (localPosition), Turn to 30,30,30
//transform.DOBlendableLocalRotateBy(new Vector3(30, 30, 30), 10);
// Ten seconds X,Y,Z The coordinates move to Self coordinate Add new Vector3( 10,10,10) Location original coordinate 3,3,3, After moving 13,13,13
//transform.DOBlendableMoveBy(new Vector3(10, 10, 10), 10);
// Ten seconds X,Y,Z It spins itself to 30,30,30( Having a parent object relative to the parent object )
//transform.DOBlendableRotateBy(new Vector3(30, 30, 30), 10);
// Ten seconds Oneself X,Y,Z The proportion of directions Add 3,3,3 Like the original scale 2,1,1 After change 5,4,4
//transform.DOBlendableScaleBy(new Vector3(10, 10, 10), 10);
// Execute the method , The change ended immediately , And complete the movement
//transform.DOComplete();
// Execute the method in the process of change , Then the object slowly changes back to its original shape , If the change is done , The method is invalid
//transform.DOFlip();
// The method is implemented in the process of change , Then the object changes to The second seconds The position of the object 、 Proportion, etc
//transform.DOGoto(2);
// Ten seconds bounce 3 Time
//transform.DOJump(new Vector3(10, 10, 10), 3, 10);
// Stop the current changes
//transform.DOKill();
// Ten seconds bounce 3 Time , The local coordinates eventually change to 10, 0, 10
//transform.DOLocalJump(new Vector3(10, 10, 10), 3, 10);
// 5 Seconds , Local coordinates change to 10,10,10
//transform.DOLocalMove(new Vector3(10, 10, 10), 5);
// 10 Seconds X The local coordinates are transformed to 5
//transform.DOLocalMoveX(5, 10);
// 10 Seconds Y Local coordinates change to 5
//transform.DOLocalMoveY(5, 10);
//10 Seconds Z Local coordinates change to 5
//transform.DOLocalMoveZ(5, 10);
//transform.DOLocalPath();
//5 Seconds Local rotation changes to 10,10, 10
//transform.DOLocalRotate(new Vector3(10, 10, 10), 5);
// I'm facing coordinate (10,10,10)
//transform.DOLookAt(new Vector3(10, 10, 10), 5);
// 5 Seconds Move to coordinate (10,10,10)
//transform.DOMove(new Vector3(10, 10, 10), 5);
//10 Seconds X Local coordinates change to 5
//transform.DOMoveX(5, 10);
//10 Seconds Y Local coordinates change to 5
//transform.DOMoveY(5, 10);
//10 Seconds Z Local coordinates change to 5
//transform.DOMoveZ(5, 10);
//
//transform.DOPath();
// Executing this method stops change
//transform.DOPause();
//transform.DOPlay();
// The method is called before the end of the change , The object returns to its original position
//transform.DOPlayBackwards();
// perform transform.DOPlayBackwards(); The object returns to its original position
// perform The following method changes again
//transform.DOPlayForward();
// Press , stay 5 Seconds between the original coordinates and the coordinates below , Punch back and forth
//transform.DOPunchPosition(new Vector3(10, 10, 10), 5);
// Press , stay 5 Seconds between the original rotation and the angle below , Press back and forth to change
//transform.DOPunchRotation(new Vector3(50, 50, 50), 5);
// Press , stay 5 Seconds between the original scale and the scale below , Press back and forth to change
//transform.DOPunchScale(new Vector3(5, 5, 5), 5);
// Before the end of change , Execute the method , Then change again
//transform.DORestart();
// The method is implemented in the process of change , Back to the original
//transform.DORewind();
// 10 Seconds Rotation Angle To (50,50,50)
//transform.DORotate(new Vector3(50, 50, 50), 5);
// 10 Seconds The ratio changes to (5,5,5)
//transform.DOScale(new Vector3(5, 5, 5), 5);
// 10 Seconds X The ratio changes to 5
//transform.DOScaleX(5, 10);
// 10 Seconds Y The ratio changes to 5
//transform.DOScaleY(5, 10);
// 10 Seconds Z The ratio changes to 5
//transform.DOScaleZ(5, 10);
// 10 Seconds object X,Y,Z The coordinates are Oneself -5 To Add yourself 5 There's a vibration between them
//transform.DOShakePosition(10, new Vector3(10, 10, 10));
// 10 Seconds , object X,Y,Z The angle of rotation is Oneself -5 To Add yourself 5 There's a vibration between them
//transform.DOShakeRotation(10, new Vector3(10, 10, 10));
// 10 Seconds , object X,Y,Z Scale in Oneself -5 To Add yourself 5 There's a vibration between them
//transform.DOShakeScale(10, new Vector3(10, 10, 10));
// Execute the method in the process of change , stop it 、 Start 、 stop it 、 Start
//transform.DOTogglePause();
// Execute the method , The coordinates immediately change to 0,5,0, from 0,5,0 Move to the initial position in two seconds
//transform.DOMove(new Vector3(0, 5, 0), 2).From();
// Execute the method , Move to the original position 6,0,2 The location of
// Like the original position 3,2,1. After moving, the position is 3+6,2+0,2+2 namely 9,2,4
//transform.DOMove(new Vector3(6, 0, 2), 2).SetRelative();
// Create a Tweener object , another number The value of the 5 It changes to 100
Tween t = DOTween.To(() => number, x => number = x, 100, 5);
// DOTween Can call continuously N The method is as follows
// Methods that can be called back in the process of executing changes
// Here is the callback method without parameters
t.OnStart(OnStartTween).OnKill(OnKill).OnPause(OnPause).OnPlay(OnPlay).OnRewind(OnRewind);
t.OnStepComplete(OnStepComplete).OnUpdate(UpdateTweenEd).OnComplete(OnComplete);
// SetAutoKill Set auto destroy
// SetDelay Setup delay
// SetEase Set the buffer type
// SetId Set up ID It can be used only int、string、object And so on
// SetLoops Set the loop type
// SetRecyclable Set to recyclable , Recyclable
// SetRelative The settings are relatively variable
// SetSpeedBased
// SetTarget
// Set up Update Value tell Tween object Whether to ignore Unity Of Of timeScale , That is, whether it is affected by Unity The effect of time
// SetUpdate(UpdateType.Normal, true)
Set to true To ignore Unity The impact of time
Set to false For not neglecting Unity The impact of time
float duration = 5; // Time
Sequence s = DOTween.Sequence();
// add to One relative to the original position Moving horizontally , Time 3 second , Buffer type by Ease.InOutQuad
s.Append(transform.DOMoveX(6, 3).SetRelative().SetEase(Ease.InOutQuad));
// Insert a rotation , Set the loop type to Come and go The way
// and will loop forward and backward twice
s.Insert(0, transform.DORotate(new Vector3(0, 45, 0), duration / 2).SetEase(Ease.InQuad).SetLoops(100, LoopType.Yoyo));
// Add a color tween that will start at half the duration and last until the end
s.Insert(duration / 2, transform.GetComponent<Renderer>().material.DOColor(Color.yellow, duration / 2));
// Set the whole Sequence to loop infinitely forward and backwards
s.SetLoops(-1, LoopType.Yoyo)
// Random setting Color
circleOutline.DOColor(RandomColor(), 1.5f).SetEase(Ease.Linear).Pause();
// Set the cooling circle With settings The callback method to complete a turn ( The callback method is implemented directly , No need to call other methods )
circleOutline.DOFillAmount(0, 1.5f).SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo)
.OnStepComplete(() =>
{
circleOutline.fillClockwise = !circleOutline.fillClockwise;
circleOutline.DOColor(RandomColor(), 1.5f).SetEase(Ease.Linear);
})
.Pause();
dotweenLogo = GetComponent<Image>();
if (dotweenLogo == null)
return;
// This is a Image The fading of , namely It's slowly becoming Can't see
dotweenLogo.DOFade(0, 1.5f).SetAutoKill(false).Pause();
#region Set up Text Happy horse , One second N A word
public Text text, relativeText, scrambledText;
private void FunctionText()
{
text = GetComponent<Text>();
// Animate the first text...
text.DOText("This text will replace the existing one", 2).SetEase(Ease.Linear).SetAutoKill(false).Pause();
relativeText = GetComponent<Text>();
// Animate the second (relative) text...
relativeText.DOText(" - This text will be added to the existing one", 2).SetRelative().SetEase(Ease.Linear).SetAutoKill(false).Pause();
scrambledText = GetComponent<Text>();
// Animate the third (scrambled) text...
scrambledText.DOText("This text will appear from scrambled chars", 2, true).SetEase(Ease.Linear).SetAutoKill(false).Pause();
DOTween.PlayAll(); // Start all Tween object
DOTween.RestartAll(); // all Tween object From the beginning
边栏推荐
- Leetcode brushing questions - hand tearing binary tree
- Standard dual airbags, Changan Lumin listed, starting at 48900 yuan
- Inductive bias的一些理解
- 等待事件 enq: KO - fast object checkpoint可行的一些处理方法
- DataGrip 2022,DataGrip 功能
- ugui图片墙
- Cisp-pte XSS Foundation
- 【torch】: 并行训练并且可以动态设置第一个gpu的batch size
- 【clickhouse专栏】新建库角色用户初始化
- JS foundation -- Date object
猜你喜欢
随机推荐
What hydraulic oil is used for Denison hydraulic pump? What are the requirements
赛灵思引脚约束文件 .xdc
About prototype and prototype chain
Understanding of the keyword this in JS
WordPress website backup
Redis transaction details
ESP8266_ SNTP(Simple Network Time Protocol)
外包干了四年,废了...
Interface, abstract class and relationship between classes
ORACLE DG物理备库使用别名数据文件改变路径到OMF路径
WordPress网站备份
标配双安全气囊,长安Lumin上市,起价4.89万元
知识点滴 - 性格分析-四类法
Empire CMS imitates DIY handmade website source code of craft activity /92kaifa imitates self-adaptive mobile phone version template of craft activity
rpc的正确打开方式|读懂Go原生net/rpc包
Pagoda panel backup and recovery data
php 中使用exec显示报错
Ora-00059 exceeds DB_ Files limit
【Objective-C】‘NSAutoreleasePool‘ is unavailable: not available in automatic reference counting mode
Using exec in PHP to display errors









