Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
iTweenとDOTweenによるループアニメーションの比較
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class StageObjectRotator : MonoBehaviour
{
[SerializeField] float duration = 0.1f, interval = 0.9f;
Transform myTrans;
void Start()
{
RotateByDOTween();
// RotateByiTween();
}
void RotateByDOTween()
{
myTrans = transform;
Sequence sequence = DOTween.Sequence();
sequence.Append(
myTrans.DORotate(Vector3.up * 90f, duration)
.SetEase(Ease.Linear)
);
sequence.AppendInterval(interval);
sequence.SetLoops(-1, LoopType.Incremental);
}
void RotateByiTween()
{
iTween.Init(gameObject);
iTween.RotateAdd(gameObject, iTween.Hash(
"y", 90f,
"time", duration,
"delay", interval,
"looptype", iTween.LoopType.loop
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment