Android Open Source - Coloring-book Acceleration Modifier

From Project

Back to project page Coloring-book.


The source code is released under:

Apache License

If you think the Android project Coloring-book listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.plattysoft.leonids.modifiers;
// ww w  .j  a v a2s. co m
import com.plattysoft.leonids.Particle;

public class AccelerationModifier implements ParticleModifier {

  private float mVelocityX;
  private float mVelocityY;

  public AccelerationModifier(float velocity, float angle) {
    float velocityAngleInRads = (float) (angle*Math.PI/180f);
    mVelocityX = (float) (velocity * Math.cos(velocityAngleInRads));
    mVelocityY = (float) (velocity * Math.sin(velocityAngleInRads));

  public void apply(Particle particle, long miliseconds) {
    particle.mCurrentX += mVelocityX*miliseconds*miliseconds;
    particle.mCurrentY += mVelocityY*miliseconds*miliseconds;


Java Source Code List