资源简介
Android撒花效果,Android撒花效果,Android撒花效果,Android撒花效果,Android撒花效果,Android撒花效果
代码片段和文件信息
package comd.yunmai.demo;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.objectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Handler;
import android.support.annotation.AttrRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.widget.frameLayout;
import java.util.Random;
/**
* author True Lies
* 星星动画View
* 三阶公式 B(T) = p0((1-t)(1-t)(1-t))+3P1t((1-t)(1-t))+3p2(t*t)(1-t)+p3(t*t*t)
* 二阶公式 B(T) = (1-t)*(1-t)*P0+2t(1-t)P1+t*t*P2
* 一阶公式 B(T) = P0+(P1-P0)*t=(1-t)P0+t*P1
* 全屏View
* Created by Coding on 2017/9/13.
*/
public class HealthSignInStarAnimView extends frameLayout{
private Context mContext = null;
private int mMaxWidth = 0;
private int mMaxHeight = 0;
private Interpolator mLinearInterpolator = new LinearInterpolator();//线性
private Interpolator mAccelerateInterpolator = new AccelerateInterpolator();//加速
private Interpolator mDecelerateInterpolator = new DecelerateInterpolator();//减速
private Interpolator mAccelerateDecelerateInterpolator = new AccelerateDecelerateInterpolator();//先加速后减速
private Interpolator[] mInterpolatorArray = null;
private Handler mHandler = new Handler();
public HealthSignInStarAnimView(@NonNull Context context) {
this(contextnull);
this.mContext = context;
}
public HealthSignInStarAnimView(@NonNull Context context @Nullable AttributeSet attrs) {
this(context attrs0);
this.mContext = context;
}
public HealthSignInStarAnimView(@NonNull Context context @Nullable AttributeSet attrs @AttrRes int defstyleAttr) {
super(context attrs defstyleAttr);
this.mContext = context;
initMeasure();
initView();
startAnim();
}
/**
* 初始化测量
*/
private void initMeasure(){
WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics displayMetrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
mMaxWidth =
评论
共有 条评论