技术文Android知识Android技术知识

安卓轻量的粒子效果系统库

2016-02-23  本文已影响280人  DeanWang
ezgif.com-video-to-gif (1).gif

https://github.com/plattysoft/Leonids

使用简单:

初始化:
<pre>
practiceView = new View(this);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
lp.topMargin = 200;
addContentView(practiceView, lp);
</pre>
调用显示:
<pre>
void playPracticle(){
ParticleSystem particleSystem = new ParticleSystem(this, 300, R.mipmap.ic_launcher, 1000)
.setSpeedRange(0.06f, 0.6f)
.setScaleRange(0.125f, 0.5f)
.setRotationSpeedRange(0.1f, 0.8f)
.setFadeOut(800, new android.view.animation.LinearInterpolator())
.setAcceleration(0.001f, 90);

particleSystem.emitWithGravity(this.practiceView, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 300, 1000);//.oneShot(wv.practiceView, 100);

}
</pre>

上一篇下一篇

猜你喜欢

热点阅读