https://github.com/plattysoft/Leonids
用第一例子oneshot为例子:
public void onClick(View arg0) {
new ParticleSystem(this, 2, R.drawable.star_pink, 3200)
.setSpeedRange(0.1f, 0.25f) // 速度在这个两值之间,随机取。是角速度啊。
.oneShot(arg0, 2); // arg0为了获得,button的坐标。这个坐标为开始点。
}
所有点都画在ParticleField上了,这是一个view。
mActiveParticles 存放所有点的坐标信息,速度。。。
private void onUpdate(long miliseconds) {
while (((mEmitingTime > 0 && miliseconds < mEmitingTime)|| mEmitingTime == -1) && // This point should emit
!mParticles.isEmpty() && // We have particles in the pool
mActivatedParticles < mParticlesPerMilisecond*miliseconds) { // and we ar