Example usage for com.badlogic.gdx.graphics.g2d ParticleEmitter getTransparency

List of usage examples for com.badlogic.gdx.graphics.g2d ParticleEmitter getTransparency

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d ParticleEmitter getTransparency.

Prototype

public ScaledNumericValue getTransparency() 

Source Link

Usage

From source file:com.lynk.gdx.tool.particleeditor.EffectPanel.java

License:Apache License

public ParticleEmitter newEmitter(String name, boolean select) {
    final ParticleEmitter emitter = new ParticleEmitter();

    emitter.getDuration().setLow(1000);/*w  ww  .j  av a2  s  .c  o m*/
    emitter.getEmission().setHigh(50);
    emitter.getLife().setHigh(500);
    emitter.getScale().setHigh(32, 32);

    emitter.getTint().setColors(new float[] { 1, 0.12156863f, 0.047058824f });
    emitter.getTransparency().setHigh(1);

    emitter.setMaxParticleCount(25);
    emitter.setImagePath(ParticleEditor.DEFAULT_PARTICLE);

    addEmitter(name, select, emitter);
    return emitter;
}

From source file:com.lynk.gdx.tool.particleeditor.EffectPanel.java

License:Apache License

public ParticleEmitter newExampleEmitter(String name, boolean select) {
    final ParticleEmitter emitter = new ParticleEmitter();

    emitter.getDuration().setLow(3000);//from   w  w w.j  a  v  a  2  s  . co m

    emitter.getEmission().setHigh(250);

    emitter.getLife().setHigh(500, 1000);
    emitter.getLife().setTimeline(new float[] { 0, 0.66f, 1 });
    emitter.getLife().setScaling(new float[] { 1, 1, 0.3f });

    emitter.getScale().setHigh(32, 32);

    emitter.getRotation().setLow(1, 360);
    emitter.getRotation().setHigh(180, 180);
    emitter.getRotation().setTimeline(new float[] { 0, 1 });
    emitter.getRotation().setScaling(new float[] { 0, 1 });
    emitter.getRotation().setRelative(true);

    emitter.getAngle().setHigh(45, 135);
    emitter.getAngle().setLow(90);
    emitter.getAngle().setTimeline(new float[] { 0, 0.5f, 1 });
    emitter.getAngle().setScaling(new float[] { 1, 0, 0 });
    emitter.getAngle().setActive(true);

    emitter.getVelocity().setHigh(30, 300);
    emitter.getVelocity().setActive(true);

    emitter.getTint().setColors(new float[] { 1, 0.12156863f, 0.047058824f });

    emitter.getTransparency().setHigh(1, 1);
    emitter.getTransparency().setTimeline(new float[] { 0, 0.2f, 0.8f, 1 });
    emitter.getTransparency().setScaling(new float[] { 0, 1, 0.75f, 0 });

    emitter.setMaxParticleCount(200);
    emitter.setImagePath(ParticleEditor.DEFAULT_PARTICLE);

    addEmitter(name, select, emitter);
    return emitter;
}

From source file:com.lynk.gdx.tool.particleeditor.ParticleEditor.java

License:Apache License

void reloadRows() {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            editRowsPanel.removeAll();/*from ww  w  .j  a  v a 2  s .c  o  m*/
            addEditorRow(new NumericPanel(pixelsPerMeter, "Pixels per meter", ""));
            addEditorRow(new NumericPanel(zoomLevel, "Zoom level", ""));
            addEditorRow(new NumericPanel(deltaMultiplier, "Delta multiplier", ""));
            addEditorRow(new GradientPanel(backgroundColor, "Background color", "", true));

            rowsPanel.removeAll();
            ParticleEmitter emitter = getEmitter();
            addRow(new ImagePanel(ParticleEditor.this, "Image", ""));
            addRow(new CountPanel(ParticleEditor.this, "Count",
                    "Min number of particles at all times, max number of particles allowed."));
            addRow(new RangedNumericPanel(emitter.getDelay(), "Delay",
                    "Time from beginning of effect to emission start, in milliseconds."));
            addRow(new RangedNumericPanel(emitter.getDuration(), "Duration",
                    "Time particles will be emitted, in milliseconds."));
            addRow(new ScaledNumericPanel(emitter.getEmission(), "Duration", "Emission",
                    "Number of particles emitted per second."));
            addRow(new ScaledNumericPanel(emitter.getLife(), "Duration", "Life",
                    "Time particles will live, in milliseconds."));
            addRow(new ScaledNumericPanel(emitter.getLifeOffset(), "Duration", "Life Offset",
                    "Particle starting life consumed, in milliseconds."));
            addRow(new RangedNumericPanel(emitter.getXOffsetValue(), "X Offset",
                    "Amount to offset a particle's starting X location, in world units."));
            addRow(new RangedNumericPanel(emitter.getYOffsetValue(), "Y Offset",
                    "Amount to offset a particle's starting Y location, in world units."));
            addRow(new SpawnPanel(ParticleEditor.this, emitter.getSpawnShape(), "Spawn",
                    "Shape used to spawn particles."));
            addRow(new ScaledNumericPanel(emitter.getSpawnWidth(), "Duration", "Spawn Width",
                    "Width of the spawn shape, in world units."));
            addRow(new ScaledNumericPanel(emitter.getSpawnHeight(), "Duration", "Spawn Height",
                    "Height of the spawn shape, in world units."));
            addRow(new ScaledNumericPanel(emitter.getScale(), "Life", "Size",
                    "Particle size, in world units."));
            addRow(new ScaledNumericPanel(emitter.getVelocity(), "Life", "Velocity",
                    "Particle speed, in world units per second."));
            addRow(new ScaledNumericPanel(emitter.getAngle(), "Life", "Angle",
                    "Particle emission angle, in degrees."));
            addRow(new ScaledNumericPanel(emitter.getRotation(), "Life", "Rotation",
                    "Particle rotation, in degrees."));
            addRow(new ScaledNumericPanel(emitter.getWind(), "Life", "Wind",
                    "Wind strength, in world units per second."));
            addRow(new ScaledNumericPanel(emitter.getGravity(), "Life", "Gravity",
                    "Gravity strength, in world units per second."));
            addRow(new GradientPanel(emitter.getTint(), "Tint", "", false));
            addRow(new PercentagePanel(emitter.getTransparency(), "Life", "Transparency", ""));
            addRow(new OptionsPanel(ParticleEditor.this, "Options", ""));
            for (Component component : rowsPanel.getComponents())
                if (component instanceof EditorPanel)
                    ((EditorPanel) component).update(ParticleEditor.this);
            rowsPanel.repaint();
        }
    });
}

From source file:de.bitbrain.craft.graphics.ParticleRenderer.java

License:Open Source License

@Override
public void setAlpha(float alpha) {

    // TODO: Alpha doesn't work for particles here as intended :(

    this.alpha = alpha;

    for (ParticleEffect e : effects.keySet()) {

        for (ParticleEmitter emitter : e.getEmitters()) {
            ScaledNumericValue v = emitter.getTransparency();
            v.setHigh(alpha);//from  w ww.  j a  v a2s  . c o  m
            v.setLow(alpha);
        }
    }
}