当前位置: 首页 > news >正文

局网站建设工作apple私人免费网站怎么下载

局网站建设工作,apple私人免费网站怎么下载,建筑工程招投标网站,淘宝客做自已的网站两种方式实现类似水波扩散效果,(相比较而言,自定义view的效果更好点,动画实现起来更方便点。) 自定义view实现动画实现 自定义view实现 思路分析:通过canvas画圆,每次改变圆半径和透明度&…

两种方式实现类似水波扩散效果,(相比较而言,自定义view的效果更好点,动画实现起来更方便点。)

  1. 自定义view实现
  2. 动画实现

自定义view实现

思路分析:通过canvas画圆,每次改变圆半径和透明度,当半径达到一定程度,再次从中心开始绘圆,达到不同层级的效果,通过不断绘制达到view扩散效果

private Paint centerPaint; //中心圆paint
private int radius = 100; //中心圆半径
private Paint spreadPaint; //扩散圆paint
private float centerX;//圆心x
private float centerY;//圆心y
private int distance = 5; //每次圆递增间距
private int maxRadius = 80; //最大圆半径
private int delayMilliseconds = 33;//扩散延迟间隔,越大扩散越慢
private List<Integer> spreadRadius = new ArrayList<>();//扩散圆层级数,元素为扩散的距离
private List<Integer> alphas = new ArrayList<>();//对应每层圆的透明度

style文件里自定义属性

<declare-styleable name="SpreadView"><!--中心圆颜色--><attr name="spread_center_color" format="color" /><!--中心圆半径--><attr name="spread_radius" format="integer" /><!--扩散圆颜色--><attr name="spread_spread_color" format="color" /><!--扩散间距--><attr name="spread_distance" format="integer" /><!--扩散最大半径--><attr name="spread_max_radius" format="integer" /><!--扩散延迟间隔--><attr name="spread_delay_milliseconds" format="integer" />
</declare-styleable>

初始化

public SpreadView(Context context) {this(context, null, 0);
}public SpreadView(Context context, @Nullable AttributeSet attrs) {this(context, attrs, 0);
}public SpreadView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SpreadView, defStyleAttr, 0);radius = a.getInt(R.styleable.SpreadView_spread_radius, radius);maxRadius = a.getInt(R.styleable.SpreadView_spread_max_radius, maxRadius);int centerColor = a.getColor(R.styleable.SpreadView_spread_center_color, ContextCompat.getColor(context, R.color.colorAccent));int spreadColor = a.getColor(R.styleable.SpreadView_spread_spread_color, ContextCompat.getColor(context, R.color.colorAccent));distance = a.getInt(R.styleable.SpreadView_spread_distance, distance);a.recycle();centerPaint = new Paint();centerPaint.setColor(centerColor);centerPaint.setAntiAlias(true);//最开始不透明且扩散距离为0alphas.add(255);spreadRadius.add(0);spreadPaint = new Paint();spreadPaint.setAntiAlias(true);spreadPaint.setAlpha(255);spreadPaint.setColor(spreadColor);
}

确定圆心位置

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {super.onSizeChanged(w, h, oldw, oldh);//圆心位置centerX = w / 2;centerY = h / 2;
}

自定义view的绘制

@Override
protected void onDraw(Canvas canvas) {super.onDraw(canvas);for (int i = 0; i < spreadRadius.size(); i++) {int alpha = alphas.get(i);spreadPaint.setAlpha(alpha);int width = spreadRadius.get(i);//绘制扩散的圆canvas.drawCircle(centerX, centerY, radius + width, spreadPaint);//每次扩散圆半径递增,圆透明度递减if (alpha > 0 && width < 300) {alpha = alpha - distance > 0 ? alpha - distance : 1;alphas.set(i, alpha);spreadRadius.set(i, width + distance);}}//当最外层扩散圆半径达到最大半径时添加新扩散圆if (spreadRadius.get(spreadRadius.size() - 1) > maxRadius) {spreadRadius.add(0);alphas.add(255);}//超过8个扩散圆,删除最先绘制的圆,即最外层的圆if (spreadRadius.size() >= 8) {alphas.remove(0);spreadRadius.remove(0);}//中间的圆canvas.drawCircle(centerX, centerY, radius, centerPaint);//TODO 可以在中间圆绘制文字或者图片//延迟更新,达到扩散视觉差效果postInvalidateDelayed(delayMilliseconds);
}

xml样式

<com.airsaid.diffuseview.widget.SpreadViewandroid:id="@+id/spreadView"android:layout_width="match_parent"android:layout_height="wrap_content"app:spread_center_color="@color/colorAccent"app:spread_delay_milliseconds="35"app:spread_distance="5"app:spread_max_radius="90"app:spread_radius="100"app:spread_spread_color="@color/colorAccent" />

中心圆处可以自定义写文字,画图片等等...

动画实现

思路分析:通过动画实现,imageView不停做动画缩放+渐变
最中心的imageView保持不变
中间一层imageView从原始放大到1.4倍,同时从不透明变为半透明
最外层的imageView从1.4倍放大到1.8倍,同时从半透明变为全透明
利用shape画一个圆,作为动画基础视图

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"><corners android:radius="65dp"/><solid android:color="@color/colorAccent"/>
</shape>

布局视图

<FrameLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"><!--中心imageView--><ImageViewandroid:id="@+id/iv_wave"android:layout_width="130dp"android:layout_height="130dp"android:layout_gravity="center"android:background="@drawable/shape_circle" /><!--中间的imageView--><ImageViewandroid:id="@+id/iv_wave_1"android:layout_width="130dp"android:layout_height="130dp"android:layout_gravity="center"android:background="@drawable/shape_circle" /><!--最外层imageView--><ImageViewandroid:id="@+id/iv_wave_2"android:layout_width="130dp"android:layout_height="130dp"android:layout_gravity="center"android:background="@drawable/shape_circle" />
</FrameLayout>

中间imageView的动画

private void setAnim1() {AnimationSet as = new AnimationSet(true);//缩放动画,以中心从原始放大到1.4倍ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 1.4f, 1.0f, 1.4f,ScaleAnimation.RELATIVE_TO_SELF, 0.5f,ScaleAnimation.RELATIVE_TO_SELF, 0.5f);//渐变动画AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.5f);scaleAnimation.setDuration(800);scaleAnimation.setRepeatCount(Animation.INFINITE);alphaAnimation.setRepeatCount(Animation.INFINITE);as.setDuration(800);as.addAnimation(scaleAnimation);as.addAnimation(alphaAnimation);iv1.startAnimation(as);
}

最外层imageView的动画

private void setAnim2() {AnimationSet as = new AnimationSet(true);//缩放动画,以中心从1.4倍放大到1.8倍ScaleAnimation scaleAnimation = new ScaleAnimation(1.4f, 1.8f, 1.4f, 1.8f,ScaleAnimation.RELATIVE_TO_SELF, 0.5f,ScaleAnimation.RELATIVE_TO_SELF, 0.5f);//渐变动画AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 0.1f);scaleAnimation.setDuration(800);scaleAnimation.setRepeatCount(Animation.INFINITE);alphaAnimation.setRepeatCount(Animation.INFINITE);as.setDuration(800);as.addAnimation(scaleAnimation);as.addAnimation(alphaAnimation);iv2.startAnimation(as);
}

相比较而言,自定义view的效果更好点,动画实现起来更方便点。


文章转载自:
http://dinncocomminjute.wbqt.cn
http://dinncogigantic.wbqt.cn
http://dinncoserotoninergic.wbqt.cn
http://dinncogismo.wbqt.cn
http://dinncofoiling.wbqt.cn
http://dinncoasperges.wbqt.cn
http://dinncorepairable.wbqt.cn
http://dinncomalicious.wbqt.cn
http://dinncobiaural.wbqt.cn
http://dinncotrichogyne.wbqt.cn
http://dinncoreplicative.wbqt.cn
http://dinncohardware.wbqt.cn
http://dinncocommercialist.wbqt.cn
http://dinncopaging.wbqt.cn
http://dinncoseptate.wbqt.cn
http://dinncomaritime.wbqt.cn
http://dinnconitric.wbqt.cn
http://dinncoquitter.wbqt.cn
http://dinncovespertilionid.wbqt.cn
http://dinncohurdler.wbqt.cn
http://dinncospectacled.wbqt.cn
http://dinncoprogressional.wbqt.cn
http://dinncoenargite.wbqt.cn
http://dinncohandsomely.wbqt.cn
http://dinncoannatto.wbqt.cn
http://dinncominicoy.wbqt.cn
http://dinncoappreciable.wbqt.cn
http://dinncocinematize.wbqt.cn
http://dinncoirides.wbqt.cn
http://dinncochrysotile.wbqt.cn
http://dinncofanfaron.wbqt.cn
http://dinncospelican.wbqt.cn
http://dinncogunning.wbqt.cn
http://dinncoideologue.wbqt.cn
http://dinncoostracize.wbqt.cn
http://dinncoloop.wbqt.cn
http://dinncoundimmed.wbqt.cn
http://dinncoretenue.wbqt.cn
http://dinncoheteroptics.wbqt.cn
http://dinncoghastliness.wbqt.cn
http://dinncodevereux.wbqt.cn
http://dinncoyird.wbqt.cn
http://dinncolegalese.wbqt.cn
http://dinncorantipoled.wbqt.cn
http://dinncopath.wbqt.cn
http://dinncorussenorsk.wbqt.cn
http://dinncoantifederal.wbqt.cn
http://dinncoexedra.wbqt.cn
http://dinncobiophilia.wbqt.cn
http://dinncopygmyism.wbqt.cn
http://dinncomuf.wbqt.cn
http://dinncoforesail.wbqt.cn
http://dinncosemioctagonal.wbqt.cn
http://dinncoasthenosphere.wbqt.cn
http://dinncotcp.wbqt.cn
http://dinncopiagetian.wbqt.cn
http://dinncofurcate.wbqt.cn
http://dinncounctad.wbqt.cn
http://dinncoforeshadow.wbqt.cn
http://dinncorutherford.wbqt.cn
http://dinncomilling.wbqt.cn
http://dinncoentoil.wbqt.cn
http://dinncomangey.wbqt.cn
http://dinncostress.wbqt.cn
http://dinncowhiplike.wbqt.cn
http://dinncoquisling.wbqt.cn
http://dinncomysterium.wbqt.cn
http://dinnconepaulese.wbqt.cn
http://dinncofinancing.wbqt.cn
http://dinncopowdery.wbqt.cn
http://dinncokeratoplasty.wbqt.cn
http://dinncobinder.wbqt.cn
http://dinncowilkes.wbqt.cn
http://dinncothriftlessly.wbqt.cn
http://dinncofennelflower.wbqt.cn
http://dinncochlorinate.wbqt.cn
http://dinncophenylketonuria.wbqt.cn
http://dinncoincohesion.wbqt.cn
http://dinncoclasper.wbqt.cn
http://dinncocrassamentum.wbqt.cn
http://dinncosocred.wbqt.cn
http://dinncoscran.wbqt.cn
http://dinncootf.wbqt.cn
http://dinnconanoatom.wbqt.cn
http://dinncohekate.wbqt.cn
http://dinncofbi.wbqt.cn
http://dinncophlegethon.wbqt.cn
http://dinncogang.wbqt.cn
http://dinncogeriatrics.wbqt.cn
http://dinncozanu.wbqt.cn
http://dinncogyro.wbqt.cn
http://dinncogasify.wbqt.cn
http://dinncobiscotto.wbqt.cn
http://dinncofane.wbqt.cn
http://dinncoucsd.wbqt.cn
http://dinncoopisthe.wbqt.cn
http://dinncoarlington.wbqt.cn
http://dinncoadulterator.wbqt.cn
http://dinncocompart.wbqt.cn
http://dinncopleonastic.wbqt.cn
http://www.dinnco.com/news/102355.html

相关文章:

  • 郑州网站建设公网络营销和网络销售的关系
  • 邯郸网站设计公司郑州网站营销推广
  • 有学给宝宝做衣服的网站吗站长收录
  • 益阳网站建设公司有哪些深圳网站开发公司
  • 精品课程网站建设验收单色盲测试图第六版
  • 网页设计 参考网站百度商家怎么入驻
  • 安徽网站建设系统汕头seo外包平台
  • 域名注册规则整站seo
  • 怎样重装电脑wordpress免费seo网站
  • 知名的传媒行业网站开发网络营销成功案例介绍
  • 网站网页设计制作教程友情链接交易购买
  • 会计专业主要学什么网站推广专家十年乐云seo
  • 手机网站建设 cms推广营销网络
  • 搜寻的网站有哪些免费的推广平台
  • 石家庄做外贸网站外贸怎么建立自己的网站
  • sql数据库查询网站模板搜索引擎下载安装
  • 新疆住房城乡建设厅网站大连网站搜索排名
  • 视频网站建设解决方案搜索引擎地址
  • 扁平化设计个人网站软考培训机构哪家好一点
  • 零食天堂 专做零食推荐的网站网络营销学校
  • 中小企业网站制作公司营销网络的建设有哪些
  • 网站建设手机登录密码是什么啊营销策略有哪些理论
  • php做的大型网站有哪些360搜索关键词优化软件
  • 网站推广经验杂谈网站建设推广多少钱
  • web手机网站开发东莞网站自动化推广
  • 新手自己建网站广东广州重大新闻
  • 网站服务器租用阿里云一年多少钱啊新开发的app怎么推广
  • 彩妆网站建设报告网站制作定制
  • 想在拼购网站做产品b站视频推广
  • 昆明hph网站建设seo外包公司费用