https://github.com/gcssloop/rotate3danimation
基于谷歌官方提供的3D翻转示例进行修改,修复了在不同设备上显示效果差异过大的问题。
https://github.com/gcssloop/rotate3danimation
Last synced: 3 months ago
JSON representation
基于谷歌官方提供的3D翻转示例进行修改,修复了在不同设备上显示效果差异过大的问题。
- Host: GitHub
- URL: https://github.com/gcssloop/rotate3danimation
- Owner: GcsSloop
- License: epl-1.0
- Created: 2015-05-08T18:14:26.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-18T06:49:29.000Z (about 8 years ago)
- Last Synced: 2025-03-22T14:22:12.940Z (3 months ago)
- Language: Java
- Size: 2.04 MB
- Stars: 156
- Watchers: 2
- Forks: 40
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
安卓3D翻转效果
## 作者微博: [@GcsSloop](http://weibo.com/GcsSloop)
### 基于谷歌官方提供的3D翻转示例进行修改,修复了在不同像素密度的设备上显示效果差异过大的问题。
## 修正前后对比
修正前 | 修正后
--- | ---
 | ## 该文件已经包含在另一个仓库中,你可以[点击这里](https://github.com/GcsSloop/SUtil)查看。
# 调用示例:
``` java
// 计算中心点(这里是使用view的中心作为旋转的中心点)
final float centerX = view.getWidth() / 2.0f;
final float centerY = view.getHeight() / 2.0f;//括号内参数分别为(上下文,开始角度,结束角度,x轴中心点,y轴中心点,深度,是否扭曲)
final Rotate3dAnimation rotation = new Rotate3dAnimation(this, start, end, centerX, centerY, 1.0f, true);
rotation.setDuration(1500); //设置动画时长
rotation.setFillAfter(true); //保持旋转后效果
rotation.setInterpolator(new AccelerateInterpolator()); //设置插值器rotation.setAnimationListener(new AnimationListener() { //设置监听器
@Override
public void onAnimationStart(Animation animation) {
}@Override
public void onAnimationRepeat(Animation animation) {
}@Override
public void onAnimationEnd(Animation animation) {
}
});
view.startAnimation(rotation); //开始动画```
## About Me