I'm having a problem in creating a yoyo scaling effect with DOTween. I have tried using DoScale, DOScaleShake and DOPunchScale. None seem to work. The rotation that I made works just fine, but I need it to scale as well and that is something I somehow cannot create.
Here is the current code
void Update()
{
DOTween.Sequence()
.Append(crownGlow.transform.DOLocalRotate(new Vector3(0, 0, 360), rotationSpeed, RotateMode.FastBeyond360).SetRelative())
.Append(crownGlow.transform.DOPunchScale(new Vector3(0.5f, 0.5f, 0.5f), scaleSpeed, 10, 1f));
}
I even tried it this way and it didn't work
DOTween.Sequence()
.Append(crownGlow.transform.DOScale(new Vector3(originalScale.x + 0.5f, originalScale.y + 0.5f, originalScale.z + 0.5f), scaleSpeed).SetEase(Ease.Linear))
.Append(crownGlow.transform.DOScale(originalScale, scaleSpeed).SetEase(Ease.Linear));
EDIT: With the help of Ryanas, I managed to figure out the solution
void Start()
{
originalScale = crownGlow.transform.localScale;
crownGlow.transform.DOLocalRotate(new Vector3(0, 0, 360), rotationSpeed, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1, LoopType.Incremental).SetRelative();
var sequence = DOTween.Sequence()
.Append(crownGlow.transform.DOScale(new Vector3(originalScale.x + 0.5f, originalScale.y + 0.5f, originalScale.z + 0.5f), scaleSpeed))
.Append(crownGlow.transform.DOScale(originalScale, scaleSpeed));
sequence.SetLoops(-1, LoopType.Restart);
}