Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Tween on object

edited May 2013 in Questions Posts: 304

Have you a solution for make something like this ? :

example = {}
example.pos = {}
example.pos.x = 0
example.pos.y = 0
example.dim = {}
example.dim.w = 10
example.dim.h = 10

tween(2, example, {pos.x=10, dim.w=20})
-- or
tween(2, example, {pos["x"]=10, dim["w"]=20})

Comments

  • Posts: 580

    You have to do the tween on pos itself:

    tween(2, example.pos, {x = 10, w = 20})
    
  • edited May 2013 Posts: 304

    @toadkick
    but w is not in pos, it's in dim =/
    and this is a simple example, but for complex object, that's difficult if I want make a complex sequence of tween.
    But if isn't possible, i make my own class x)

  • Posts: 580

    oh sorry, you're right...you'd have to do 2 separate simultaneous tweens in that case:


    tween(2, example.pos, {x=10}) tween(2, example.dim, {w=20})

    You could just put x, y, w, and h directly into your example table if you must only do one tween at a time:


    example = {} example.x = 0 example.y = 0 example.w = 10 example.h = 10 tween(2, example, {x=10, w=20})
  • edited May 2013 Posts: 304

    i know... it's shame, let's start another class. thanks anyhow @toadkick ;)

Sign In or Register to comment.