自定义动画
来源:互联网 发布:中国护理质量数据平台 编辑:程序博客网 时间:2024/06/16 10:33
创建自定义动画
1、覆盖父类的initialize方法,实现初始化工作。
2、实现applyTransformation的逻辑。
@Override protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); }
第一个参数:差值器时间因子,范围0-1.0。
第二个参数:矩阵的封装类。可以用来获得当前的矩阵对象,通过改版matrix来实现效果的动画。
final Matrix matrix = t.getMatrix();
模拟电视开机
public class MyAnimation extends Animation { private int mCenterX; private int mCenterY; private Camera camera = new Camera(); @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); setDuration(500); setFillAfter(true); setInterpolator(new LinearInterpolator()); mCenterX = width / 2; mCenterY = height / 2; } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); final Matrix matrix = t.getMatrix(); camera.save(); if (interpolatedTime < 0.8) { matrix.preScale(1 + 0.625f * interpolatedTime, 1 - interpolatedTime / 0.8f + 0.01f, mCenterX, mCenterY); } else { matrix.preScale(7.5f * (1 - interpolatedTime), 0.01f, mCenterX, mCenterY); } camera.restore(); }}
1 0
- 自定义动画
- 自定义动画
- 自定义动画
- 自定义动画
- 自定义动画&动画总结
- Extjs动画效果(自定义动画)
- android动画(2)自定义动画
- 自定义转场动画 pop动画
- jq-05动画&自定义动画
- jQuery动画---自定义动画animate()
- 8、自定义动画--动画篇
- jQuery自定义动画
- 自定义 pushViewController 的动画
- 自定义PopupWindow动画效果
- android 自定义对话框动画
- JQUERY自定义动画函数
- UINavigationController 自定义动画
- Android 自定义动画
- windows下使用bat脚本操作ftp服务器
- 浅谈java异常[Exception]
- 基于haystack的分布式小文件存储系统bfs
- lua & c & c++
- 机器学习(周志华) 参考答案 第十二章 计算理论学习
- 自定义动画
- Android基础-Android中的HashMap浅析
- open()和fopen()的区别
- 二叉树的遍历(先序/中序/后序,递归/迭代)与搜索
- rabbitmq+haproxy+keepalived实现高可用集群搭建
- 1875: [SDOI2009]HH去散步
- 共享内存做进程间消息队列
- HTML5概述
- Groupcache解读和性能压测