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.
package com.plattysoft.leonids.initializers; /* ww w . j ava 2s . c om*/ import java.util.Random; import com.plattysoft.leonids.Particle; public class SpeeddByComponentsInitializer implements ParticleInitializer { private float mMinSpeedX; private float mMaxSpeedX; private float mMinSpeedY; private float mMaxSpeedY; public SpeeddByComponentsInitializer(float speedMinX, float speedMaxX, float speedMinY, float speedMaxY) { mMinSpeedX = speedMinX; mMaxSpeedX = speedMaxX; mMinSpeedY = speedMinY; mMaxSpeedY = speedMaxY; } @Override public void initParticle(Particle p, Random r) { p.mSpeedX = r.nextFloat()*(mMaxSpeedX-mMinSpeedX)+mMinSpeedX; p.mSpeedY = r.nextFloat()*(mMaxSpeedY-mMinSpeedY)+mMinSpeedY; } }