Animating Polyline Point Positions using DOTween
Hello! I'm trying to animate the points on a Polyline using DOTween.
When I manually set these points using the SetPointPosition API, it works:
//for (int i = 0; i < OutlineRenderer.Count; i++)
//{
// OutlineRenderer.SetPointPosition(i, defaultDrawnHexPointPositions[i] * 1.5f);
//}
However, when I try to do the same thing using the DOTween generic getter/setter API, it doesn't respond at all:
Sequence unitHexHighlighterDefault = DOTween.Sequence();
for (int i = 0; i < OutlineRenderer.Count; i++)
{
unitHexHighlighterDefault.Insert(0f, DOTween.To(() => OutlineRenderer.points[i].point, x => OutlineRenderer.SetPointPosition(i, x), defaultDrawnHexPointPositions[i] * 1.5f, TweenDuration));
}
unitHexHighlighterDefault.SetEase(Ease.Linear);
unitHexHighlighterDefault.Play();
Is there something specific I have to do to be able to animate the points of a Polyline using DOTween?
Yeah everything was properly configured. I did end up getting it working, based on your Revealer sample script:
// Animate Outline Opacity
//Sequence unitHexHighlighterYoyoSelected = SandboxManager.Instance.ResetHexOutlineVisibilitySequence();
//unitHexHighlighterYoyoSelected.Insert(0f, DOTween.To(() => OutlineRevealer.t, x => { OutlineRevealer.t = x; OutlineRevealer.UpdatePolyline(); }, 0.5f, TweenDuration * 0.5f));
//unitHexHighlighterYoyoSelected.Insert(TweenDuration * 0.5f, DOTween.To(() => OutlineRevealer.t, x => { OutlineRevealer.t = x; OutlineRevealer.UpdatePolyline(); }, 1f, TweenDuration * 0.5f));
//unitHexHighlighterYoyoSelected.SetEase(Ease.InOutSine);
//unitHexHighlighterYoyoSelected.SetLoops(-1, LoopType.Yoyo);
//unitHexHighlighterYoyoSelected.Play();