Author Topic: Animate flyer from position x,y to position x+400,y+400  (Read 359 times)

iOtero

  • Sr. Member
  • ****
  • Posts: 233
    • View Profile
Animate flyer from position x,y to position x+400,y+400
« on: August 04, 2018, 09:50:44 AM »
Well, with animate.nut i managed to make horizontal animations:

Code: [Select]
::OBJECTS <- {artwk = fe.add_image("objs/emulators/[Emulator]", flx*0.75, fly*0.005, flw*0.25, flh*0.162)}
local move_artwk1 = {when = Transition.ToNewSelection, property = "x", start = OBJECTS.artwk.x + OBJECTS.artwk.width, end = OBJECTS.artwk.x, time = 1}
local move_artwk2 = {when = When.ToNewSelection, property = "x", start = OBJECTS.artwk.x, end = OBJECTS.artwk.x + (OBJECTS.artwk.width*1.5), time = my_time, delay=my_delay}
animation.add(PropertyAnimation(OBJECTS.artwk, move_artwk1));
animation.add(PropertyAnimation(OBJECTS.artwk, move_artwk2));

and vertically:

Code: [Select]
::OBJECTS <- {surface = fe.add_surface(sw, sh)}
local daframe = OBJECTS.surface.add_image("objs/frames/frame_red.png", 0, 0, sw, sh);
local title = OBJECTS.surface.add_text("[Title]", sx*0.001+1, sy*0.2+1, sw*0.75, sh*0.01);
local move_surface1 = {when = Transition.ToNewSelection, property = "y", start = flh, end = OBJECTS.surface.y, time = 1}
local move_surface2 = {when = When.ToNewSelection, property = "y", start = OBJECTS.surface.y, end = flh, time = my_time, delay=my_delay}
animation.add(PropertyAnimation(OBJECTS.surface, move_surface1));
animation.add(PropertyAnimation(OBJECTS.surface, move_surface2));

And now i want to move an object from the center of the screen to the lower right corner (from position x,y to position x+400,y+400), and i do not know if it can be done.

And it does not matter to me that first it moves horizontally and then vertically or that it goes directly diagonally, but yes, in a single movement of the wheel

Any ideas to do it?
« Last Edit: August 29, 2018, 05:08:47 AM by iOtero »
I love that on my laptop the eyes shine to the Alien every time i access the ssd... :D

iOtero

  • Sr. Member
  • ****
  • Posts: 233
    • View Profile
Re: Animate flyer from position x,y to position x+400,y+400
« Reply #1 on: August 29, 2018, 03:32:54 AM »
Does anyone tell me anything?
I love that on my laptop the eyes shine to the Alien every time i access the ssd... :D

dukpoki

  • Full Member
  • ***
  • Posts: 89
    • View Profile
Re: Animate flyer from position x,y to position x+400,y+400
« Reply #2 on: August 31, 2018, 08:25:16 AM »
Just adjust the delay for the second movement to start at the end of the 1st movement.  So if it takes 600ms to move the picture from x pos 1 to x pos 2 with delay 0, then set the second animation (y pos 1 to y pos 2) to start at 600ms (delay 600ms).

I have no idea how to make it go diagonally.  Though I would love to know if it's possible.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 672
    • View Profile
Re: Animate flyer from position x,y to position x+400,y+400
« Reply #3 on: August 31, 2018, 09:15:49 AM »
Liquid8d created the animate module. Maybe send him a message? Or review the module on github?

If you can’t figure it out, you could always create the movement yourself by creating a class to accept positions and monitoring ticks to move the object. Things like easing and stacking other animations would get more complicated than I could do - that’s where the module shines.

iOtero

  • Sr. Member
  • ****
  • Posts: 233
    • View Profile
Re: Animate flyer from position x,y to position x+400,y+400
« Reply #4 on: September 04, 2018, 03:30:06 AM »
To do it diagonally, you would need more parameters, x, y of origin e x, of destination, and that is not contemplated. I do not know if it can be done, but I do not think so, since you can not draw a diagonal line either.  :-\
I love that on my laptop the eyes shine to the Alien every time i access the ssd... :D