Skip to content

Commit

Permalink
Migrate from DOTween to PrimeTween.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyrylo Kuzyk committed May 21, 2023
1 parent 7dd4d88 commit 628cb17
Show file tree
Hide file tree
Showing 19 changed files with 1,575 additions and 1,111 deletions.
2,608 changes: 1,540 additions & 1,068 deletions Assets/Scenes/Motion.unity

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Assets/Scripts/Click/ClickViewer.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;
using Utilities;

public class ClickViewer : MonoBehaviour
{
Expand All @@ -22,8 +21,7 @@ private void Start()
sequence.Append(circle.DOFade(0, FADE_DURATION / 2))
.Join(ripple.DOFade(0, FADE_DURATION))
.Join(ripple.rectTransform.DOScale(2f, FADE_DURATION))
.SetLink(gameObject)
.OnComplete(() => Destroy(gameObject));
.ChainCallback(() => Destroy(gameObject));
}

public void SetColor(Color color)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week1/Chart.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
Expand Down
17 changes: 6 additions & 11 deletions Assets/Scripts/Week1/Crown.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;

Expand Down Expand Up @@ -32,8 +32,6 @@ private void Start()
/// </summary>
private void PlayAnimation()
{
var param = new TweenParams().SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutSine);

DOTween.Sequence()
.Append(stand.DOAnchorPosY(UP_POS, 0))
.Join(crown.DOAnchorPosY(UP_POS, 0))
Expand All @@ -50,14 +48,11 @@ private void PlayAnimation()
.Join(crown.DOLocalRotate(Vector3.forward * -2f, 0.4f))
.Join(shadow.DOFade(0.16f, 0.4f))
.Join(shadow.rectTransform.DOScale(1f, 0.4f))
.AppendCallback(() =>
{
DOTween.Sequence()
.Append(crown.DOAnchorPosY(30f, 0.8f))
.Join(shadow.DOFade(0, 0.8f))
.Join(shadow.rectTransform.DOScale(1.12f, 0.8f))
.SetAs(param);
crown.DOLocalRotate(Vector3.forward * 2f, 0.55f).SetAs(param);
.AppendCallback(() => {
crown.DOAnchorPosY(30f, 0.8f).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutSine);
shadow.DOFade(0, 0.8f).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutSine);
shadow.rectTransform.DOScale(1.12f, 0.8f).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutSine);
crown.DOLocalRotate(Vector3.forward * 2f, 0.55f).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutSine);
})
.Append(lights.DOScale(1, 0.4f))
.AppendCallback(() =>
Expand Down
9 changes: 4 additions & 5 deletions Assets/Scripts/Week1/LikeButton.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DG.Tweening;
using DG.Tweening.Plugins.Options;
using PrimeTween;
using Extensions;
using TMPro;
using UnityEngine;
Expand All @@ -15,7 +14,7 @@ public class LikeButton : MonoBehaviour, IPointerDownHandler
[SerializeField] private Image[] lines;

private bool isLike;
private Sequence sequence;
private Sequence? sequence;


private Vector2[] defaultLinePositions;
Expand Down Expand Up @@ -52,7 +51,7 @@ private void Activate()
sequence?.Complete();

sequence = DOTween.Sequence()
.OnStart(() =>
.ChainCallback(() =>
{
inactiveIcon.SetAlpha(0);
activeIcon.SetAlpha(1);
Expand Down Expand Up @@ -85,7 +84,7 @@ private void Inactivate()
inactiveColor.a = 1;

sequence = DOTween.Sequence()
.OnStart(() =>
.ChainCallback(() =>
{
inactiveIcon.SetAlpha(1);
for (var i = 0; i < lines.Length; i++)
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Week1/Loading.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using Extensions;
using UnityEngine;
using UnityEngine.UI;
Expand Down Expand Up @@ -39,7 +39,7 @@ private void PlayAnimation()
var ripple = ripples[i];

DOTween.Sequence()
.OnStart(() =>
.ChainCallback(() =>
{
Initialize(firstPoint, secondPoint, ripple);
})
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week1/Loading2.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using Extensions;
using UnityEngine;
using UnityEngine.UI;
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scripts/Week1/OnOffToggle.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
Expand All @@ -21,7 +21,7 @@ public class OnOffToggle : MonoBehaviour, IPointerDownHandler
[SerializeField] private Color activeOffColor;

private bool isOn;
private Sequence sequence;
private Sequence? sequence;


/// <summary>
Expand Down Expand Up @@ -62,7 +62,7 @@ private void UpdateState()
var circleSize = isOn ? 800f : 0;

sequence = DOTween.Sequence()
.OnStart(() =>
.ChainCallback(() =>
{
inactiveText.color = inactiveColor;
handleFront.color = inactiveColor;
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Week2/Bounce.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;

Expand Down Expand Up @@ -50,7 +50,7 @@ private void PlayAnimation()
.Join(ball.rectTransform.DOScaleX(0.8f, 0.2f))
.Join(ball.rectTransform.DOScale(new Vector3(1, 0.8f, 1), 0.2f).SetDelay(0.2f))
.SetEase(Ease.Linear)
.SetLoops(-1, LoopType.Yoyo);
.SetLoops(-1); // todo LoopType.Yoyo is not supported on sequences
}

}
4 changes: 2 additions & 2 deletions Assets/Scripts/Week2/Cooking.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using DG.Tweening;
using PrimeTween;
using UnityEngine;

public class Cooking : MonoBehaviour
Expand All @@ -19,7 +19,7 @@ private void PlayAnimation()
.Join(rice.DOLocalRotate(Vector3.zero, 0))
.Append(panParent.DOLocalRotate(Vector3.back * -20f, 0.2f))
.Join(panParent.DOLocalRotate(Vector3.back * 40f, 0.4f).SetDelay(0.2f))
.Join(rice.DOLocalRotate(Vector3.back * 180, 1f))
.Join(rice.DOLocalRotate(Vector3.back * 179, 1f)) // using 180 degrees has unpredictable rotation direction
.Join(panParent.DOLocalRotate(Vector3.back * -10f, 0.8f).SetDelay(0.4f))
.Join(rice.DOLocalRotate(Vector3.back * 360, 0.8f).SetEase(Ease.InQuad))
.Join(panParent.DOLocalRotate(Vector3.zero, 0.2f).SetDelay(0.8f))
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week2/Skateboard.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week2/Space.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week2/WaveHand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week3/Hello.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using DG.Tweening;
using PrimeTween;
using Extensions;
using UnityEngine;
using UnityEngine.UI;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week3/Kiitos.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week3/MindPost.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using Extensions;
using UnityEngine;
using UnityEngine.UI;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Week3/MotionDesignFes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using PrimeTween;
using Extensions;
using UnityEngine;
using UnityEngine.UI;
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scripts/Week3/Page404.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using Extensions;
using UnityEngine;
using UnityEngine.UI;
Expand All @@ -25,7 +25,7 @@ private void Awake()
private void PlayAnimation()
{
DOTween.Sequence()
.OnStart(() =>
.ChainCallback(() =>
{
foreach (var image in images404) image.SetAlpha(0);
background.localScale = Vector3.one * 2f;
Expand All @@ -34,7 +34,7 @@ private void PlayAnimation()
.Append(images404[0].DOFade(1, 0.4f))
.Join(images404[1].DOFade(1, 0.4f))
.Join(images404[2].DOFade(1, 0.4f))
.OnComplete(() =>
.ChainCallback(() =>
{
background.DOScale(1.04f, 1f)
.SetEase(Ease.InOutQuad)
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Week3/Shapes.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using PrimeTween;
using Extensions;
using UnityEngine;
using UnityEngine.UI;
Expand Down Expand Up @@ -93,7 +93,7 @@ private void PlayAnimation()
DOTween.Sequence()
.Append(triangles[i].DOScale(1, BEAT * 3 / 2))
.Join(triangles[i].DOAnchorPos(trianglePoses[i], BEAT * 3 / 2).SetEase(Ease.OutCirc))
.Join(triangles[i].DOLocalRotate(Vector3.forward * 180, BEAT * 3 / 2, RotateMode.FastBeyond360).SetRelative(true))
.Join(triangles[i].DOLocalRotate(Vector3.forward * 180, BEAT * 3 / 2).SetRelative(true))
.Append(triangles[i].DOScale(0, BEAT / 2));
}
})
Expand Down

0 comments on commit 628cb17

Please sign in to comment.