DOTWeen generic tweener
Most generic way to write tweener with DOTWeen I usually can’t remember
This is the most flexible way of tweening and allows you to tween almost any value, either public or private, static or dynamic (just so you know, the shortcuts way actually uses the generic way in the background).
static DOTween.To(getter, setter, to, float duration)
Changes the given property from its current value to the given one.
getter A delegate that returns the value of the property to tween. Can be written as a lambda like this: ()=> myValue
where myValue is the name of the property to tween.
setter A delegate that sets the value of the property to tween. Can be written as a lambda like this: x=> myValue = x
where myValue is the name of the property to tween.
to The end value to reach.
duration The duration of the tween.
Examples
// Tween a Vector3 called myVector to 3,4,8 in 1 second DOTween.To(()=> myVector, x=> myVector = x, new Vector3(3,4,8), 1); // Tween a float called myFloat to 52 in 1 second DOTween.To(()=> myFloat, x=> myFloat = x, 52, 1);