Author Topic: Particle animation question  (Read 2809 times)

Arcadefan1

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Particle animation question
« on: January 06, 2019, 11:18:08 AM »
Hi guys!
I am playing around with particle animation. I have one question. How can I make a particle animation visible or invisible!

Code: [Select]
ParticleAnimation.visible = false;

This doesn't work.

Can someone give me a hint please?

qqplayer

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
Re: Particle animation question
« Reply #1 on: January 06, 2019, 01:20:23 PM »
Code: [Select]
ParticleAnimation.alpha = 0;

Arcadefan1

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Particle animation question
« Reply #2 on: January 07, 2019, 10:01:05 PM »
That doesn't seem to work. The particle animation stays visible.

qqplayer

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
Re: Particle animation question
« Reply #3 on: January 08, 2019, 01:19:56 PM »
Code: [Select]
    Default Config values:
   
        when = When.ToNewSelection, // optional     when to start animation
                                    //               - default is When.Immediate
        time = 500                  // optional     length of the animation in ms
                                    //               - default is 1000
        delay = 0                   // optional     time to wait before starting animation
        wait = false                // optional     whether this is a waiting transition animation
        loop = false                // optional     whether to loop the animation (at end, start from beginning)
                                    //               - integer|true|false (def)
        pulse = false,              // optional     whether to pulse animation (play in reverse at end)
                                    //               - integer|true|false (def)
        restart = true,             // optional     whether the animation should restart if it is already running and should run again
                                    //               - true (def)|false
   
    ParticleAnimation Config values:
   
        resources = [ "1.png", "2.png" ]    // optional     an array of image resources that will be used
                                            //               - a default image is used if nothing is specified
        ppm = 60                            // optional     particles per minute
                                            //               - default is 60
        x = 480                             // optional     x location of the particle emitter
        y = 480                             // optional     y location of the particle emitter
                                            //               - default is screen center
        width = 1                           // optional     width of the particle emitter
        height = 1                          // optional     height of the particle emitter
        limit = 0                           // optional     limit of emitted particles
        movement = true                     // optional     if particles are affected by speed, accel, gravity, xOscillate   
        angle = [ 0, 0 ]                    // optional     min and max angle of particles emitted
        speed = [ 150, 150 ]                // optional     min and max speed of particles emitted over lifespan
        scale = [ 1.0, 1.0 ]                // optional     min and max scale of particles emitted over lifespan
        startScale = [ 1.0, 1.0 ]           // optional     min and max scale of particle at emission
        rotate = [ 0, 0 ]                   // optional     mix and max rotation of particle over lifespan
        rotateToAngle = false               // optional     whether to rotate to angle?
        fade = 0                            // optional     length of time in ms to fade the particles alpha value
        gravity = 0                         // optional     gravity modification ( -75 to 75 )
        accel = 0                           // optional     add acceleration ( 0 to 20 )
        bound = [ 0, 0, 0, 0 ]              // optional     a bounding rectangle that particles will not leave
        xOscillate = [ 0, 0 ]               // optional     modify amp/freq of particle emission (
        lifespan = 5000                     // optional     lifespan of particle
        particlesontop = true               // optional     ???
        pointSwarm = [ 0, 0 ]               // optional     ???
        blendmode = "none"                  // optional     ???
        randomFrame = false                 // optional     ???
   
    Notes:
        The ParticleAnimation system is based on the HyperTheme particle system.

Alpha property isnt created.
So I suppose you need to add a new alpha property or just use 'fade'

Quote
       fade = 0                            // optional     length of time in ms to fade the particles alpha value

Arcadefan1

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Particle animation question
« Reply #4 on: January 15, 2019, 10:27:59 AM »
I seem to have a more basic problem with this. I can't change any property of the particle animation after it is created. Let say I try to set "y" to 0. no matter what syntax I try, I am not getting anywhere.

Code: [Select]
local particle_cfg = {
    resources = [ "resources/mario.png", "resources/link.png" ],    //file resources - comma separated
    ppm = 30,               //how many particles per minute will be created
    x = 50,                  //the x location of the particle emitter
    y = 100,                  //the y location of the particle emitter
    width = 100,           //the width of the particle emitter
    height = 360,             //the height of the particle emitter
    speed = [ 100, 250 ],   //randomizes the speed of the resource when it is first created
    angle = [ 0, 15 ],     //the angle where particles will be emitted (min, max)
    startScale = [ 1, 1 ],  //randomizes the scale of the resource when it is first created
    gravity = 0,            //gravity attached to the particle
    fade = 0,           //fade the alpha over time
    lifespan = 10000,       //how long the resource will 'live'
    scale = [ 0.5, 0.5 ],     //scale the resource over its lifespan
}

animation.add( ParticleAnimation( particle_cfg ) );

// try to change the y property after the animation was created

ParticleAnimation.y = 0;


This is the code I have put I n my layout file. Whatever syntax I have tried to change the value of "y" after the animation was created didn't work.

The final question is:
How do I change any property of the particle animation after it was created with the initial settings?

Any help is appreciated:)