It looks like you're new here. If you want to get involved, click one of these buttons!
-- '''''''''''''''''''''''''' -- ANIMATE -- '''''''''''''''''''''''''' -- OBJ 1 local tween1 = GTween.new(obj1, 1, {y = obj1:getY() + 100}, {reflect = true, setLoop = true, repeatCount = 0}) -- OBJ 2 local tween2 = GTween.new(obj2, 4, {x = 800, y = obj2:getY() - 500}, {reflect = true, setLoop = true, repeatCount = 0}) -- OBJ 3 local tween3 = GTween.new(obj3, 1, {y = obj3:getY() + 100}, {reflect = true, setLoop = true, repeatCount = 0}) local tween4 = GTween.new(obj3, 4, {x = 800, y = obj3:getY() - 500}, {reflect = true, setLoop = true, repeatCount = 0}) |
Comments
thank you for this answer.
Your solution works well in some cases but in some others it has its limits when you don't want to change the hierarchy of your objects.
Does GTween work with global coordinates only? - local coordinates would be the solution
That would be great if there was a difference between globalX (current "x" value if I understand well) and localX that would be the local X for the object.
@Petec
True, in fact reflect, etc... was extracted from my test file (reflected for debugging).
I tried with an enter frame event but I need the flexibility of GTween to achieve what I want (more complex than my question on this post).
If GTween could work with local coordinates, that would be great.
@ar2rsawseen Would you have any idea on how to achieve that?
Moving a child on y axis is basically moving using local coordinates (relative to parent position) so it seems to solve problem.
@Mells if you want local coordinates you still will need local coordinates relative to something
Only other way I can imagine to modify one object's same property from two different tweens, in this specific case, is to use transformations. You would need to rewrite Sprite:set function to accept translation from Transformation matrix (basically using dy parameter).
http://www.giderosmobile.com/forum/discussion/comment/5973
And then try to tween translation and position.
Do not know if it works because somewhere deep it should be the same as changing position coordinates.