Author Topic: animate module  (Read 25791 times)

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: animate module
« Reply #15 on: June 03, 2015, 12:42:08 AM »
OK, I pushed my new version of animate to github...
https://github.com/liquid8d/attract-extra/tree/master/modules

Just a note if you are using the current version - I MOVED the animate.nut to the main module directory - so delete the old animate/ folder - and you'll need to update your layouts to use fe.load_module("animate") instead of fe.load_module("animate/animate"); Annoying - but that's cleaner and it won't change anymore :)

Here's what's new:

Updated animate module to what is now AnimateVersion 1.1
   
animate.nut
     - moved animate.nut to base module path
     - moved animations to the animate folder - each have their own folder for resources
     - now loads .nut files in the animate folder - to support additional animations
     - put positions back in (not sure if they all work)
     - fixed animation transitions When.OnPageUp and When.OnPageDown error
     - moved evaluate function to the Animation base class so it can be used for other animations
   
PropertyAnimations
     - fix for unscaled images/artwork ( note: some property attributes like scale, rotation and position won't work right without a provided width/height )
   
ParticleAnimations
     - 'surface' can be provided to a ParticleAnimation config to say which surface to draw on (default is the standard fe surface = on top of objects drawn before it was created. this means you can now create a surface under your objects )
     - moved particles debug emitter angle lines to center of emitter
   
SpriteAnimations
     - fixed bug that crashed AM when using a SpriteAnimation and the image was missing
     - added some presets for sprites ( SpriteAnimations.joystick_left, joystick_right, joystick_up, joystick_down, joystick_leftright, joystick_updown, button_red, button_white )

Plus my new sample_animate tutorial layout is available that has a walkthrough on what you can do - slightly updated from the video earlier :)

https://github.com/liquid8d/attract-extra/tree/master/layouts/sample_animate

omegaman

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 880
    • View Profile
Re: animate module
« Reply #16 on: June 03, 2015, 04:10:43 AM »
Super! :) Well, that didn't take long. I'm not worthy... ;D

raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
Re: animate module
« Reply #17 on: June 09, 2015, 10:46:16 PM »
This is great liquid8d... I haven't had much free time lately but I'll definitely check it out when I get the chance.

ArcadeBliss

  • Sr. Member
  • ****
  • Posts: 195
    • View Profile
[Solved] Re: animate module
« Reply #18 on: April 27, 2016, 11:05:45 PM »
I've been working with this module for my new layout and have to say, it is a work of beauty. It simplifies the whole animation process enorm.

I have a problem I was hoping you could assist with. I try to move the x and y coordinates of an image at the same time;however, the animation only occurs on the property that occurs latest. In the example below, only the "y" property will be executed.

Do you know how can I achieve this effect?

Code: [Select]
local myImage = fe.add_image("thefile.png",0,0,100,100);


add.animation(PropertyAnimation(myImage, { property ="x",  start = 0, end = 15}));
add.animation(PropertyAnimation(myImage, { property ="y",  start = 0, end = 15}));

SOLUTION: I found the solution in the source code. There is a "position" property I can use to give the x,y coordinates.  Just wonderful.
« Last Edit: April 27, 2016, 11:48:34 PM by ArcadeBliss »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: animate module
« Reply #19 on: May 12, 2016, 03:55:04 PM »
got some work done on particle effects:

https://gfycat.com/LimpingAcrobaticAdeliepenguin

Just a few random effects together. Most of this could be done before, the big new thing here is you can have multiple emitters with a single particleanimation. The code looks like this:

Code: [Select]
local anim = ParticleAnimation()
                .name("multiple_emitters")
                .target(OBJECTS.surface)
                .delay("3s")
                .duration(-1)
                .resources([ "resources/circle.png" ])
                .startScale( [ 0.25, 0.1 ] )
                .scale([0.25, 0.1])
                .accel(1)
                .lifespan("4s")
                .x(50)
                .y(20)
                .width(1)
                .height(150)
                .ppm(60)
                .colors( [ [ 255, 0, 0 ] ])
                .next_emitter()
                    .resources([ "resources/square.png" ])
                    .startScale( [ 0.25, 0.1 ] )
                    .scale([0.25, 0.1])
                    .accel(1)
                    .lifespan("4s")
                    .x(50)
                    .y(190)
                    .width(1)
                    .height(150)
                    .ppm(60)
                    .colors( [ [ 255, 0, 255 ] ])
                    .next_emitter()
                        .resources([ "resources/circle.png" ])
                        .startScale( [ 0.25, 0.1 ] )
                        .scale([0.25, 0.1])
                        .accel(1)
                        .lifespan("4s")
                        .x(-20)
                        .y(0)
                        .width(1)
                        .height(fe.layout.height)
                        .ppm(300)
                        .limit(1000)
                        .colors( [ [ 200, 200, 200 ], [ 200, 0, 0 ], [ 200, 200, 0 ], [ 0, 200, 0 ] ])
                    .next_emitter()
                        //rain
                        .resources([ "resources/drop.png" ])
                        .startScale( [ 0.05, 0.05 ] )
                        .scale([0.05, 0.07])
                        .speed([ 200, 400 ])
                        .angle([90,90])
                        .accel(1)
                        .gravity(20)
                        .lifespan("4s")
                        .x(0)
                        .y(-20)
                        .width(fe.layout.width)
                        .height(1)
                        .burst(10)
                        .ppm(420)
                        .colors( [ [ 118, 135, 222 ], [ 77, 93, 174 ], [ 89, 115, 247 ] ])
                    .next_emitter()
                        //snow
                        .resources([ "resources/snow.png" ])
                        .startScale( [ 0.25, 0.1 ] )
                        .scale([0.25, 0.1])
                        .angle([90,90])
                        .gravity(-10)
                        .xOscillate([20,500])
                        .lifespan("4s")
                        .x(0)
                        .y(-20)
                        .width(fe.layout.width)
                        .height(1)
                        .ppm(240)
                        .colors( [ [ 245, 245, 245 ] ])
                    .next_emitter()
                        //scratches
                        .resources([ "resources/scratch.png" ])
                        .startScale( [ 1, 1 ] )
                        .movement(false)
                        .lifespan("10s")
                        .x(0)
                        .y(0)
                        .width(fe.layout.width)
                        .height(fe.layout.height)
                        .ppm(240)
                .play();

I also added a few new attributes like burst and  a colors array - still have more planned :) I will get a test version together of the whole animate module soon but I have some kinks out before anyone starts using this new version in their layouts. I also need to see what kind of performance improvements I can do, max particles is pretty limited on something low-end.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: animate module
« Reply #20 on: May 13, 2016, 02:17:42 AM »
Looking forward to testing it! 8)

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: animate module
« Reply #21 on: February 28, 2017, 05:39:35 AM »
how can I assign a current object position as start position for the animation?
ive tried:
Code: [Select]
onUpdate = function ( anim ) { if ("last" in anim.config) { debugText.msg = anim.config.last.x } },but .last does not exist, I need that for the situation when I play a new animation but the old one hasn't finished, so I need to know the current position of the object.

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: animate module
« Reply #22 on: February 28, 2017, 04:06:42 PM »
how can I assign a current object position as start position for the animation?
ive tried:
Code: [Select]
onUpdate = function ( anim ) { if ("last" in anim.config) { debugText.msg = anim.config.last.x } },but .last does not exist, I need that for the situation when I play a new animation but the old one hasn't finished, so I need to know the current position of the object.

This might be a little tricky with the current animate module, but I think you should be able to access anim.object - which is your target object for the animation and you could get its current property values in the update function...

In the animate module I am working on, there is states - like "start" and "current" to make something like this easier.