Android 仿微信红包动画特效一分钟搞定 您所在的位置:网站首页 微信表情红包雨特效图片 Android 仿微信红包动画特效一分钟搞定

Android 仿微信红包动画特效一分钟搞定

2024-07-18 02:28| 来源: 网络整理| 查看: 265

简单来说你多在微信中发几个群红包就能有一些思路,但是有些特定的状态需要注意前后端配合。

搞了半个小时TMD没有把视频转换成GIF,直接上照片吧,醉了~

1.支付完成之后会出现第一个图,打开第二个图的时候当前界面是有一个动画效果的,可以微信中发个群红包试试~

无非是图片抖两下,这里将第二张的红包总布局设置Animation

然后在Activity中调就ok了

Animation animationLayout = AnimationUtils.loadAnimation(this, R.anim.award_anima); awardAnimationLayout.setAnimation(animationLayout);

2.点击图二的开的时候,想让这个图片转动,如果你们的UI妹子就给你一张这个图,只能让当前这个图片按照Y轴转动了

定义一个Animation自己去画吧

package shangche.club.geton.view; import android.graphics.Camera; import android.graphics.Matrix; import android.view.animation.Animation; import android.view.animation.DecelerateInterpolator; import android.view.animation.Transformation; /** * Created by HuoWei on 2017/12/18. */ public class AwardRotateAnimation extends Animation { int centerX, centerY; Camera camera = new Camera(); @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); //获取中心点坐标 centerX = width / 2; centerY = height / 2; //动画执行时间 自行定义 setDuration(800); setInterpolator(new DecelerateInterpolator()); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { final Matrix matrix = t.getMatrix(); camera.save(); //中心是绕Y轴旋转 这里可以自行设置X轴 Y轴 Z轴 camera.rotateY(360 * interpolatedTime); //把我们的摄像头加在变换矩阵上 camera.getMatrix(matrix); //设置翻转中心点 matrix.preTranslate(-centerX, -centerY); matrix.postTranslate(centerX, centerY); camera.restore(); } } 直接在Activity中调用就OK了,

AwardRotateAnimation animation = new AwardRotateAnimation(); animation.setRepeatCount(Animation.INFINITE); openGroupAward.startAnimation(animation); 网络请求结束后跳转到详情时,记得清空View的状态

openGroupAward.clearAnimation();

demo下载地址:http://download.csdn.net/download/android_hv/10166569



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有