From c1d3ed476eb56ca360a1a0b7018396b90f83d19e Mon Sep 17 00:00:00 2001 From: sloop Date: Wed, 13 May 2015 11:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加调用示例 --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 175edd1..77fd0fd 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,38 @@ #基于谷歌官方提供的3D翻转示例进行修改,修复了在不同像素密度的设备上显示效果差异过大的问题。 +#调用示例: + + + + // 计算中心点(这里是使用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); //开始动画 + + + ##修正后 ![image](https://github.com/GcsSloop/Rotate3dAnimation/blob/master/Pic/%E4%BF%AE%E6%AD%A3%E5%90%8E.gif) ##修正前