ME;
? ? ? ? ? ? ? ? int angle = (int) (rotateFraction * 360);
? ? ? ? ? ? ? ? // 根据叶子旋转方向确定叶子旋转角度
? ? ? ? ? ? ? ? int rotate = leaf.rotateDirection == 0 ? angle + leaf.rotateAngle : -angle
? ? ? ? ? ? ? ? ? ? ? ? + leaf.rotateAngle;
? ? ? ? ? ? ? ? matrix.postRotate(rotate, transX
? ? ? ? ? ? ? ? ? ? ? ? + mLeafWidth / 2, transY + mLeafHeight / 2);
? ? ? ? ? ? ? ? canvas.drawBitmap(mLeafBitmap, matrix, mBitmapPaint);
? ? ? ? ? ? ? ? canvas.restore();
? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? }
? ? }
最后,向外层暴露几个接口:
? ? /**
? ? * 设置中等振幅
? ? *
? ? * @param amplitude
? ? */
? ? public void setMiddleAmplitude(int amplitude) {
? ? ? ? this.mMiddleAmplitude = amplitude;
? ? }
? ? /**
? ? * 设置振幅差
? ? *
? ? * @param disparity
? ? */
? ? public void setMplitudeDisparity(int disparity) {
? ? ? ? this.mAmplitudeDisparity = disparity;
? ? }
? ? /**
? ? * 获取中等振幅
? ? *
? ? * @param amplitude
? ? */
? ? public int getMiddleAmplitude() {
? ? ? ? return mMiddleAmplitude;
? ? }
? ? /**
? ? * 获取振幅差
? ? *
? ? * @param disparity
? ? */
? ? public int getMplitudeDisparity() {
? ? ? ? return mAmplitudeDisparity;
? ? }
? ? /**
? ? * 设置进度
? ? *
? ? * @param progress
? ? */
? ? public void setProgress(int progress) {
? ? ? ? this.mProgress = progress;
? ? ? ? postInvalidate();
? ? }
? ? /**
? ? * 设置叶子飘完一个周期所花的时间
? ? *
? ? * @param time
? ? */
? ? public void setLeafFloatTime(long time) {
? ? ? ? this.mLeafFloatTime = time;
? ? }
? ? /**
? ? * 设置叶子旋转一周所花的时间
? ? *
? ? * @param time
? ? */
? ? public void setLeafRotateTime(long time) {
? ? ? ? this.mLeafRotateTime = time;
? ?
这些接口用来干嘛呢?用于把我们的动效做成完全可手动调节的,这样做有什么好处呢?
1. 更加便于产品、射鸡湿查看效果,避免YY,自己手动调节,不会出现要你一遍遍的改参数安装、查看、再改、再查看... ... N遍之后说 “这好像不是我想要的” -- 瞬间天崩地裂,天昏地暗,感觉被全世界抛弃;
2. 便于体现你是一个考虑全面,思维缜密,会编程、会设计的艺术家,当然这纯属YY,主要还是方便大家;
如此一来,射鸡湿们只需要不断的调节即可实时的看到展现的效果,最后只需要把最终的参数反馈过来即可,万事大吉,一了百了;
当然,如果对方是个漂亮的妹子,而你又苦于没有机会搭讪,以上内容就当我没说,尽情的不按要求写吧,她肯定会主动找你的,说不定连饭都反过来请了... ...