默认墨迹天气 下雪效果
来源:互联网 发布:淘宝电商是什么意思 编辑:程序博客网 时间:2024/05/02 04:46
WeatherAnimationDemo
项目地址:KitTak/WeatherAnimationDemo
简介:默认墨迹天气 下雪效果
模仿墨迹下雪效果
在布局中直接通过自定义 SurfaceView 来绘制提高效率
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent"> <com.kit.weather.animation.view.SceneSurfaceView android:id="@+id/sceneSurfaceView" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout>
通过配置文件来控制雪花降落速度、位置
weather_scene_slight_snow_day.xml
SnowFall.java
protected SnowFall(Context context) { super(context); // 设置是否使用抗锯齿功能,会消耗较大资源,绘制图形速度会变慢 paint.setAntiAlias(false); // 如果该项设置为 true,则图像在动画进行中会滤掉对 Bitmap 图像的优化操作,加快显示速度,本设置项依赖于 dither 和 xfermode 的设置 paint.setFilterBitmap(true); // 设定是否使用图像抖动处理,会使绘制出来的图片颜色更加平滑和饱满,图像更加清晰 paint.setDither(true); try { listXMLData = SaxService.getInstance().readXML(context, "weather_scene_slight_snow_day.xml"); } catch (Exception e) { e.printStackTrace(); } getViewSize(context); loadRainImage(context); addRandomRain(); } private void snowDown(ActorInfo snow) { // 雪花的落出屏幕后又让它从顶上下落 if (snow.getX() > screenWidth || snow.getY() > screenHeiht) { snow.setY(0); snow.setX(random.nextFloat() * screenWidth); } snow.setX(snow.getX() + snow.getOffset());// 下落飘的偏移量 snow.setY(snow.getY() + snow.getSpeed());// 下落的速度 }
0 0
- 默认墨迹天气 下雪效果
- 利用SurfaceView实现墨迹天气雪花效果
- Android使用SurfaceView实现墨迹天气的风车效果
- Android使用SurfaceView实现墨迹天气的风车效果
- Android使用SurfaceView实现墨迹天气的风车效果
- Android自定义view--SurfaceView实现墨迹天气的风车效果
- 仿墨迹天气的折线图控件,效果杠杠滴.
- 仿墨迹天气的折线图控件,效果杠杠滴
- 墨迹天气新玩法
- JavaGG android实现uc 和墨迹天气那样的左右拖动效果
- android实现uc和墨迹天气那样的左右拖动效果
- android实现uc和墨迹天气那样的左右拖动效果
- android实现uc和墨迹天气那样的左右拖动效果
- android实现uc和墨迹天气那样的左右拖动效果
- android实现uc和墨迹天气那样的左右拖动效果
- 墨迹天气3.0引导动画
- 墨迹天气3.0引导动画
- 高仿墨迹天气黄历
- caffe层解读系列——hinge_loss
- OpenCasCade的显示模块(visulation模块)概要说明
- Android自学笔记-5-click事件的四种写法
- PHP: session.gc_maxlifetime vs. session.cookie_lifetime
- 分布式系统中利用zookeeper集群实现微服务主备切换代码片段(C语言版)
- 默认墨迹天气 下雪效果
- Centos7下通过virt-v2v将libvirt管理下的vm迁移至ovirt中
- 缩略词
- docker创建本地镜像(二)及Dockerfile的语法
- opengles膨胀吹气特效
- 51nod-1215 数组的宽度(单调栈)
- rsync实现文件备份同步
- Beyond Compare使用初步-Folder Compare
- 面试题