Skip to content

循环绘制下落物体的View,可以模拟雪花、雨滴、金币等物体样式的飘落效果

License

Notifications You must be signed in to change notification settings

AnliaLee/FallingView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

雪花飘落效果

方法名 参数解析
setSpeed(int speed) 设置物体的初始下落速度
setSpeed(int speed,boolean isRandomSpeed) 设置物体的初始下落速度isRandomSpeed:物体初始下降速度比例是否随机
setSize(int w, int h) 设置物体大小
setSize(int w, int h, boolean isRandomSize) 设置物体大小isRandomSize:物体初始大小比例是否随机
setWind(int level,boolean isWindRandom,boolean isWindChange) 设置风力等级、方向以及随机因素level:风力等级,isWindRandom:物体初始风向和风力大小比例是否随机,isWindChange:在物体下落过程中风的风向和风力是否会产生随机变化
  • 初始化示例:
//初始化一个雪花样式的fallObject
FallObject.Builder builder = new FallObject.Builder(getResources().getDrawable(R.drawable.ic_snow));
FallObject fallObject = builder
		.setSpeed(7,true)
		.setSize(50,50,true)
		.setWind(5,true,true)
		.build();

fallingView = (FallingView) findViewById(R.id.fallingView);
fallingView.addFallObject(fallObject,100);//添加50个下落物体对象
  • 效果展示:


About

循环绘制下落物体的View,可以模拟雪花、雨滴、金币等物体样式的飘落效果

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages