com.plattysoft.leonids.ParticleSystem Java Examples

The following examples show how to use com.plattysoft.leonids.ParticleSystem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FollowCursorExampleActivity.java    From Leonids with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onTouchEvent(MotionEvent event) {
	switch (event.getAction()) {
	case MotionEvent.ACTION_DOWN:
		// Create a particle system and start emiting
		ps = new ParticleSystem(this, 100, R.drawable.star_pink, 800);
		ps.setScaleRange(0.7f, 1.3f);
		ps.setSpeedRange(0.05f, 0.1f);
		ps.setRotationSpeedRange(90, 180);
		ps.setFadeOut(200, new AccelerateInterpolator());
		ps.emit((int) event.getX(), (int) event.getY(), 40);
		break;
	case MotionEvent.ACTION_MOVE:
		ps.updateEmitPoint((int) event.getX(), (int) event.getY());
		break;
	case MotionEvent.ACTION_UP:
		ps.stopEmitting();
		break;
	}
	return true;
}
 
Example #2
Source File: FireworksExampleActivity.java    From Leonids with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View arg0) {
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_pink, 800);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedRange(0.1f, 0.25f);
	ps.setRotationSpeedRange(90, 180);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.oneShot(arg0, 70);

	ParticleSystem ps2 = new ParticleSystem(this, 100, R.drawable.star_white, 800);
	ps2.setScaleRange(0.7f, 1.3f);
	ps2.setSpeedRange(0.1f, 0.25f);
	ps.setRotationSpeedRange(90, 180);
	ps2.setFadeOut(200, new AccelerateInterpolator());
	ps2.oneShot(arg0, 70);
}
 
Example #3
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
public void WriteBlankAnimation(View animBlank) {
    YoYo.with(Techniques.RubberBand)
            .duration(500)
            .playOn(findViewById(animBlank.getId()));


    sfxManager.KeyboardClickPlay(true);

    new ParticleSystem(this, 5, R.drawable.star_white, 800)
            .setScaleRange(0.7f, 1.3f)
            .setSpeedRange(0.1f, 0.25f)
            .setRotationSpeedRange(90, 180)
            .setFadeOut(200, new AccelerateInterpolator())
            .oneShot(animBlank, 100);
}
 
Example #4
Source File: DrawerActivity.java    From Coloring-book with Apache License 2.0 5 votes vote down vote up
public void finish_anim() {
    Animation animFadein = AnimationUtils.loadAnimation(
            getApplicationContext(), R.anim.slide_finish);
    level_finished.setVisibility(View.VISIBLE);
    animFadein.setAnimationListener(finish_anim);

    level_finished.startAnimation(animFadein);

    int count = screenH / 100;

    for (int i = 0; i < count; i++) {
        int id_image = 0;
        if (i % 2 == 0)
            id_image = R.drawable.star_pink;
        else
            id_image = R.drawable.star_white;

        ParticleSystem ps = new ParticleSystem(this, 100, id_image, 800);
        ps.setScaleRange(0.7f, 1.3f);
        ps.setSpeedRange(0.2f, 0.5f);
        ps.setRotationSpeedRange(90, 180);
        ps.setFadeOut(200, new AccelerateInterpolator());
        int xStart = (int) (screenW * Math.random());
        int yStart = (int) (screenH * Math.random());
        ps.oneShot(xStart, yStart, 70);
    }


    final Animation scale = AnimationUtils.loadAnimation(
            getApplicationContext(), R.anim.scale_anim);

    homeBtn.startAnimation(scale);

    Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
    tracker.send(MapBuilder
            .createEvent("Level", packName, "finish_drawing_" + level, null)
            .build());

}
 
Example #5
Source File: EmiterTimeLimitedExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_pink, 1000);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedModuleAndAngleRange(0.07f, 0.16f, 0, 180);
	ps.setRotationSpeedRange(90, 180);
	ps.setAcceleration(0.00013f, 90);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.emit(arg0, 100, 2000);
}
 
Example #6
Source File: EmiterIntermediateExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {		
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_pink, 1000);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedModuleAndAngleRange(0.07f, 0.16f, 0, 180);
	ps.setRotationSpeedRange(90, 180);
	ps.setAcceleration(0.00013f, 90);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.emit(arg0, 100);
}
 
Example #7
Source File: OneShotAdvancedExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {
	// Launch 2 particle systems one for each image
	ParticleSystem ps = new ParticleSystem(this, 100, R.drawable.star_white_border, 800);
	ps.setScaleRange(0.7f, 1.3f);
	ps.setSpeedRange(0.1f, 0.25f);
	ps.setAcceleration(0.0001f, 90);
	ps.setRotationSpeedRange(90, 180);
	ps.setFadeOut(200, new AccelerateInterpolator());
	ps.oneShot(arg0, 100);
}
 
Example #8
Source File: ConfettiExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {		
	new ParticleSystem(this, 80, R.drawable.confeti2, 10000)
	.setSpeedModuleAndAngleRange(0f, 0.1f, 180, 180)
	.setRotationSpeed(144)
	.setAcceleration(0.000017f, 90)		
	.emit(findViewById(R.id.emiter_top_right), 8);
			
	new ParticleSystem(this, 80, R.drawable.confeti3, 10000)
	.setSpeedModuleAndAngleRange(0f, 0.1f, 0, 0)
	.setRotationSpeed(144)
	.setAcceleration(0.000017f, 90)		
	.emit(findViewById(R.id.emiter_top_left), 8);
}
 
Example #9
Source File: PlayActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
public void WriteBlankAnim(View animBlank){
    YoYo.with(Techniques.RubberBand)
            .duration(500)
            .playOn(findViewById(animBlank.getId()));

    sfxManager.KeyboardClickPlay(true);

    new ParticleSystem(this, 5, R.drawable.star_white, 800)
            .setScaleRange(0.7f, 1.3f)
            .setSpeedRange(0.1f, 0.25f)
            .setRotationSpeedRange(90, 180)
            .setFadeOut(200, new AccelerateInterpolator())
            .oneShot(animBlank, 100);
}
 
Example #10
Source File: DustExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 4, R.drawable.dust, 3000)
	.setSpeedByComponentsRange(-0.025f, 0.025f, -0.06f, -0.08f)		
	.setAcceleration(0.00001f, 30)
	.setInitialRotationRange(0, 360)
	.addModifier(new AlphaModifier(255, 0, 1000, 3000))
	.addModifier(new ScaleModifier(0.5f, 2f, 0, 1000))
	.oneShot(findViewById(R.id.emiter_bottom), 4);
}
 
Example #11
Source File: EmiterWithGravityExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 100, R.drawable.star_pink, 3000)
	.setAcceleration(0.00013f, 90)
	.setSpeedByComponentsRange(0f, 0f, 0.05f, 0.1f)
	.setFadeOut(200, new AccelerateInterpolator())
	.emitWithGravity(arg0, Gravity.BOTTOM, 30);
}
 
Example #12
Source File: StarsExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 10, R.drawable.star, 3000)		
	.setSpeedByComponentsRange(-0.1f, 0.1f, -0.1f, 0.02f)
	.setAcceleration(0.000003f, 90)
	.setInitialRotationRange(0, 360)
	.setRotationSpeed(120)
	.setFadeOut(2000)
	.addModifier(new ScaleModifier(0f, 1.5f, 0, 1500))
	.oneShot(arg0, 10);
}
 
Example #13
Source File: AnimatedParticlesExampleActivity.java    From Leonids with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 100, R.drawable.animated_confetti, 5000)		
	.setSpeedRange(0.1f, 0.25f)
	.setRotationSpeedRange(90, 180)
	.setInitialRotationRange(0, 360)
	.oneShot(arg0, 100);
}
 
Example #14
Source File: EmiterSimpleExampleActivity.java    From Leonids with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 50, R.drawable.star_pink, 1000)
	.setSpeedRange(0.1f, 0.25f)
	.emit(arg0, 100);
}
 
Example #15
Source File: EmiterBackgroundSimpleExampleActivity.java    From Leonids with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 50, R.drawable.star_pink, 1000, R.id.background_hook)
	.setSpeedRange(0.1f, 0.25f)
	.emit(arg0, 100);
}
 
Example #16
Source File: OneShotSimpleExampleActivity.java    From Leonids with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View arg0) {
	new ParticleSystem(this, 100, R.drawable.star_pink, 800)		
	.setSpeedRange(0.1f, 0.25f)
	.oneShot(arg0, 100);
}
 
Example #17
Source File: PlayActivity.java    From FixMath with Apache License 2.0 4 votes vote down vote up
public void VisibleAndAnimationLines(int calcLineSwitch){

        View calcLine;

        switch (calcLineSwitch) {
            case 0:
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line2));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line3));


                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line2));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line3));


                break;

            case 1:
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line3));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line4));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line3));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line4));
                break;

            case 2:
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line4));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line5));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line4));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line5));
                break;
            case 3:
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line3));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line2));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line3));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line2));
                break;
            case 4:
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line4));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.Line3));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line4));
                YoYo.with(Techniques.ZoomIn)
                        .duration(350)
                        .playOn(findViewById(R.id.transparent_line3));
                break;
        }


        calcLine = findViewById(R.id.keyboard);
        new ParticleSystem(this, 5, R.drawable.star_white, 800)
                .setScaleRange(0.7f, 1.3f)
                .setSpeedRange(0.1f, 0.25f)
                .setRotationSpeedRange(90, 180)
                .setFadeOut(200, new AccelerateInterpolator())
                .oneShot(calcLine, 100);
        calcLine = findViewById(R.id.calculations);
        calcLine.clearAnimation();
        setClickableRecursive(calcLine, false);

    }