Package 

Class Confetti

  • All Implemented Interfaces:

    
    public final class Confetti
    
                        

    Confetti holds all data to the current state of the particle Each frame update triggers the render method, which recalculates the particle's properties based on its current state.

    • Method Detail

      • getAlphaColor

         final Integer getAlphaColor()

        The color of the particle with the current alpha value applied

      • setAlphaColor

         final Unit setAlphaColor(Integer alphaColor)

        The color of the particle with the current alpha value applied

      • getDrawParticle

         final Boolean getDrawParticle()

        Determines whether the particle should be drawn. Set to false when the particle moves out of the view

      • getLocation

         final Vector getLocation()

        The current position of the particle as a Vector object that contains x and y coordinates.

      • setLocation

         final Unit setLocation(Vector location)

        The current position of the particle as a Vector object that contains x and y coordinates.

      • getWidth

         final Float getWidth()

        The width of the particle in pixels.

      • getShape

         final Shape getShape()

        The geometric shape of the particle.

      • getLifespan

         final Long getLifespan()

        The duration the particle should exist for in milliseconds.

      • setLifespan

         final Unit setLifespan(Long lifespan)

        The duration the particle should exist for in milliseconds.

      • getFadeOut

         final Boolean getFadeOut()

        If true, the particle will gradually become transparent over its lifespan.

      • getDamping

         final Float getDamping()

        A factor that reduces the particle's velocity over time, simulating air resistance. A higher damping value will slow down the particle faster.

      • setDamping

         final Unit setDamping(Float damping)

        A factor that reduces the particle's velocity over time, simulating air resistance. A higher damping value will slow down the particle faster.

      • getPixelDensity

         final Float getPixelDensity()

        The pixel density of the device's screen. This is used to ensure that the particle's movement looks consistent across devices with different screen densities.

      • getSize

         final Float getSize()

        Returns the size of the particle in pixels

      • isDead

         final Boolean isDead()

        Checks if the particle is "dead", i.e., its alpha value has reached 0

      • applyForce

         final Unit applyForce(Vector force)

        Applies a force to the particle, which affects its acceleration

      • render

         final Unit render(Float deltaTime, CoreRect drawArea)

        Updates the state of the particle for each frame of the animation.