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

含山微信搭建网站建设外贸营销网站建设公司

含山微信搭建网站建设,外贸营销网站建设公司,文章类型的网站模版,seo成功案例分析最终效果如下 ValueAnimator类API 简介 ofFloat(float… values) 构建ValueAnimator#xff0c;设置动画的浮点值#xff0c;需要设置2个以上的值setDuration(long duration) 设置动画时长#xff0c;默认的持续时间为300毫秒。setInterpolator(TimeInterpolator value) 设…最终效果如下 ValueAnimator类API 简介 ofFloat(float… values) 构建ValueAnimator设置动画的浮点值需要设置2个以上的值setDuration(long duration) 设置动画时长默认的持续时间为300毫秒。setInterpolator(TimeInterpolator value) 设置动画的线性非线性运动默认AccelerateDecelerateInterpolatoraddUpdateListener(ValueAnimator.AnimatorUpdateListener listener) 监听动画属性每一帧的变化 分解步骤计算一下总共需要的角度: 1、一个笑脸x轴下方的圆弧旋转135°覆盖2个点此过程中圆弧增加45° 2、画布旋转135°此过程中圆弧增加45° 3、画布旋转360°此过程中圆弧减少360/5度 4、画布旋转90°此过程中圆弧减少90/5度 5、画布旋转135°释放覆盖的2个点 实现 package com.zj.test;import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import android.view.animation.DecelerateInterpolator;/*** Created by jjx on 2016/5/28.*/ public class customView extends View{// public customView(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // // initAnimator(animatorDuration); // mPaintnew Paint(); // mPaint.setStyle(Paint.Style.STROKE);//设置画笔样式为描边如果已经设置可以忽略 // mPaint.setColor(Color.GREEN); // mPaint.setStrokeWidth(10); // }float Width;float Height;public customView(Context context, AttributeSet attrs) {super(context, attrs);initAnimator(animatorDuration);mPaintnew Paint();mPaint.setStyle(Paint.Style.STROKE);//设置画笔样式为描边如果已经设置可以忽略mPaint.setColor(Color.GREEN);mPaint.setStrokeWidth(10);}Overrideprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {super.onMeasure(widthMeasureSpec, heightMeasureSpec);WidthMeasureSpec.getSize(widthMeasureSpec);mViewWidthWidth;HeightMeasureSpec.getSize(heightMeasureSpec);}Paint mPaint;float mViewWidth;Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);canvas.translate(Width/2,Height/2);doubanAnimator(canvas, mPaint);}private ValueAnimator animator;private float animatedValue;private long animatorDuration 5000;private TimeInterpolator timeInterpolator new DecelerateInterpolator();private void initAnimator(long duration){if (animator !null animator.isRunning()){animator.cancel();animator.start();}else {animatorValueAnimator.ofFloat(0,855).setDuration(duration);animator.setInterpolator(timeInterpolator);animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {Overridepublic void onAnimationUpdate(ValueAnimator animation) {animatedValue (float) animation.getAnimatedValue();invalidate();}});animator.start();}}private void doubanAnimator(Canvas canvas, Paint mPaint){mPaint.setStyle(Paint.Style.STROKE);//描边mPaint.setStrokeCap(Paint.Cap.ROUND);//圆角笔触mPaint.setColor(Color.rgb(97, 195, 109));mPaint.setStrokeWidth(15);float point Math.min(mViewWidth,mViewWidth)*0.06f/2;float r point*(float) Math.sqrt(2);RectF rectF new RectF(-r,-r,r,r);canvas.save();// rotateif (animatedValue135){canvas.rotate(animatedValue-135);}// draw mouthfloat startAngle0, sweepAngle0;if (animatedValue135){startAngle animatedValue 5;sweepAngle 170animatedValue/3;}else if (animatedValue270){startAngle 1355;sweepAngle 170animatedValue/3;}else if (animatedValue630){startAngle 1355;sweepAngle 260-(animatedValue-270)/5;}else if (animatedValue720){startAngle 135-(animatedValue-630)/25;sweepAngle 260-(animatedValue-270)/5;}else{startAngle 135-(animatedValue-630)/2-(animatedValue-720)/65;sweepAngle 170;}canvas.drawArc(rectF,startAngle,sweepAngle,false,mPaint);// draw eyecanvas.drawPoints(new float[]{-point,-point,point,-point},mPaint);canvas.restore();}} 布局文件 ?xml version1.0 encodingutf-8? RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parenttools:contextcom.zj.test.MainActivitycom.zj.test.customViewandroid:layout_widthmatch_parentandroid:layout_heightmatch_parent/com.zj.test.customView /RelativeLayout 参考链接 自定义View——Canvas与ValueAnimator – Idtk
http://www.yutouwan.com/news/273382/

相关文章:

  • 中文网站排行榜锦州做网站公司
  • 玉溪做网站公司网站搭建收费参考
  • 装修设计公司logo广州seo关键词优化外包
  • 六盘水住房和城乡建设部网站做婚恋网站有哪些
  • 南京明月建设集团网站桂林漓江船票官网订票
  • 上海网站制作最大的公司wordpress被篡改文件
  • 正规企业网站开发使用方法ps做图 游戏下载网站
  • 网站推广服务报价表门户网站软文
  • 温建设文件发布在哪个网站在线设计网站排名
  • 网站开发先学什么中国建设网站红黑榜名单
  • 佘山网站建设wordpress 会员分销
  • 门户网站后台管理系统黄页推广app软件
  • 马鞍山做网站公司排名百度seo代理
  • 霸州住房和城乡建设厅网站网站开发环境的配置
  • 做网站的网页用什么软件好网站建设主流编程软件
  • 国外做任务网站有哪些定制建站
  • wordpress多站点模式杭州富阳网站建设公司
  • 网站开发需要学php吗贵阳网站如何推广
  • 强生公司营销网站为什么要这样做写作网站哪个比较赚钱
  • 域联网站建设小网站关键词
  • 湘潭做网站价格品牌磐石网络做网站联系
  • vip视频解析网站建设泉州网上房地产
  • 美食网站建设项目分析报告百度seo wordpress插件
  • 做营销最好的网站源码普通网站成微网站开发
  • 河北建设集团有限公司网站win2003做网站
  • 宁波网站关键词排名推广wordpress 轻博客 主题
  • 梁山县网站建设网站搭建设计
  • php是用来做网站的吗网站建设费用详细表
  • 福州网站建设优化wordpress农业模板
  • 电子商务网站建设也管理网站建设毕业设计论文