Skip to content

Instantly share code, notes, and snippets.

@hvc-neoria
Created January 2, 2018 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hvc-neoria/957f3be283c464cf9aa7835729e49284 to your computer and use it in GitHub Desktop.
Save hvc-neoria/957f3be283c464cf9aa7835729e49284 to your computer and use it in GitHub Desktop.
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