Forgive the pun, but looking for a bit of a ‘sanity check’ on using Tweens with Classes…
So, as a ‘stripped down’ example - we can represent ‘position’ using vec2 within a simple class to hold the x,y coords:
self.pos = vec2(0,0)
and then tween by referencing directly the x index as a target:
subject = self.pos
target = {x = WIDTH}
tweenID = tween(5, subject, target)
All fine and dandy!
However, how would this work with a single variable and what should ‘target’ in this instance be?
self.rotate = 0
subject = self.rotate
target = ??????
tweenID = tween(5, subject, target)
I guess the issue is that self.rotate is not ‘userdata’ (ie vec2 etc) and hence I can’t seem to work out the correct syntax or a ‘simple’ way of representing easily what a ‘target’ should be.
As a hack, this works fine if a treat pos and rotate as a vec3 (using the z index as the rotate) - but there must be an easier way of tweening a single (non user-data) variable within a class?