`
- 浏览:
41859 次
- 性别:
- 来自:
北京
-
- public class CubeAnimation extends Animation implements
- Animation.AnimationListener {
-
public static final int FACE_LEFT = 0;
-
public static final int FACE_RIGHT = 1;
-
private int mInd;
-
private float mFromDegrees;
-
private float mToDegrees;
-
private float mCenterX;
-
private float mCenterY;
-
private int mHorizonType = 1;
-
private float mHorizonValue = 0.5F;
-
private Camera mCamera;
-
private View mView;
-
-
public CubeAnimation(int ind) {
-
this.mInd = ind;
-
this.mFromDegrees = 0.0F;
-
this.mToDegrees = 90.0F;
- }
-
-
public CubeAnimation(Context context, AttributeSet attrs) {
-
super(context, attrs);
- TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.CubeAnimation);
-
-
this.mFromDegrees = 0.0F;
-
this.mToDegrees = 90.0F;
-
-
Description d = Description.parseValue(a.peekValue(0));
-
this.mHorizonType = d.type;
-
this.mHorizonValue = d.value;
-
-
this.mInd = a.getInt(1, 0);
-
-
boolean t = a.getBoolean(2, true);
-
if (!(t)) {
-
this.mInd = (1 - this.mInd);
-
this.mToDegrees = 0.0F;
-
this.mFromDegrees = 90.0F;
- }
- a.recycle();
- }
-
-
public void onAnimationStart(Animation anim) {
-
this.mView.setVisibility(View.VISIBLE);
- }
-
-
public void onAnimationEnd(Animation anim) {
-
this.mView.setVisibility((this.mInd == 0) ? 0 : 8);
-
this.mInd = (1 - this.mInd);
- }
-
-
public void onAnimationRepeat(Animation anim) {
- }
-
-
public static void startCubeAnimation(Context context, int id, View view1,
- View view2) {
- XmlPullParser parser;
-
try {
- parser = context.getResources().getAnimation(id);
- AttributeSet attrs = Xml.asAttributeSet(parser);
-
-
int type = parser.getEventType();
-
int depth = parser.getDepth();
-
while (true) {
-
while (true) {
-
if ((((type = parser.next()) == 3) && (parser.getDepth() <= depth))
-
|| (type == 1))
-
break label172;
-
if (type == 2)
-
break;
- }
-
- String name = parser.getName();
-
-
if (name.equals("cube")) {
-
CubeAnimation anim1 = new CubeAnimation(context, attrs);
-
anim1.mInd = 1;
- anim1.mView = view1;
- anim1.setAnimationListener(anim1);
-
CubeAnimation anim2 = new CubeAnimation(context, attrs);
-
anim2.mInd = 0;
- anim2.mView = view2;
- anim2.setAnimationListener(anim2);
- view1.startAnimation(anim1);
- label172: view2.startAnimation(anim2);
- }
- }
-
} catch (Resources.NotFoundException ex) {
-
Log.e("CubeAnimation", "NotFoundException");
-
} catch (XmlPullParserException ex) {
-
Log.e("CubeAnimation", "XmlPullParserException");
-
} catch (IOException ex) {
-
Log.e("CubeAnimation", "IOException");
- }
- }
-
-
public void initialize(int width, int height, int parentWidth,
-
int parentHeight) {
-
super.initialize(width, height, parentWidth, parentHeight);
-
this.mCenterX = resolveSize(1, 0.5F, width, parentWidth);
-
this.mCenterY = resolveSize(1, 0.5F, height, parentHeight);
-
if (this.mHorizonType == 0) {
-
this.mHorizonValue /= height;
- }
-
-
this.mCamera = new Camera();
- }
-
-
protected void applyTransformation(float interpolatedTime, Transformation t) {
-
float fromDegrees = this.mFromDegrees;
-
float degrees = fromDegrees + (this.mToDegrees - fromDegrees)
- * interpolatedTime;
-
-
float centerX = this.mCenterX;
-
float centerY = this.mCenterY;
-
Camera camera = this.mCamera;
-
- Matrix matrix = t.getMatrix();
-
- camera.save();
-
-
float b = 0.0F;
-
float e = -this.mHorizonValue;
-
-
if (this.mInd == 0) {
-
degrees += 90.0F;
- }
-
- camera.rotateY(degrees);
-
- camera.getMatrix(matrix);
- camera.restore();
-
-
if (this.mInd == 0) {
-
matrix.preScale(-1.0F, 1.0F, centerX, 0.0F);
- }
-
-
float tranX = 320.0F * interpolatedTime;
-
-
float tranY = -centerY * e + b;
-
matrix.preTranslate(0.0F, centerY * e);
- matrix.postTranslate(tranX, tranY);
- }
-
-
protected static class Description {
-
public int type;
-
public float value;
-
-
static Description parseValue(TypedValue value) {
-
Description d = new Description();
-
if (value == null) {
-
d.type = 0;
-
d.value = 0.0F;
-
} else {
-
if (value.type == 6) {
-
d.type = (((value.data & 0xF) == 1) ? 2 : 1);
-
- d.value = TypedValue.complexToFloat(value.data);
-
return d;
- }
-
if (value.type == 4) {
-
d.type = 0;
- d.value = value.getFloat();
-
return d;
- }
-
if ((value.type >= 16) && (value.type <= 31)) {
-
d.type = 0;
- d.value = value.data;
-
return d;
- }
- }
-
-
d.type = 0;
-
d.value = 0.0F;
-
-
return d;
- }
- }
- }
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
3D桌面屏保,内包含着国内外1000多种3D动画,让你的桌面不再单调。
令人心曠神怡的水世界3D桌面!水桌面3D是一个三维动画墙纸,可以把水,雨,海浪等放在你的桌面上,桌面就会变成水动态效果。第一次执行这程式的时候令我联想起一个以前在网页中常见的水中涟漪 java 特效从3D 这名字就...
令人心旷神怡的水世界3D桌面,水桌面3D是一个三维动画墙纸,可以把水,雨,海浪等放在你的桌面上,桌面就会变成水动态效果。
BluffTitler 是 Outerspace 公司旗下的一款3D立体文本演示动画设计制作工具,亿破姐使用它无需昂贵的费用就能制作专业的三维动画。程序内置了大量的实例模版,不管新手或专业用户都能轻松设计制作。除了内置大量的...
一款3D立体文本演示动画设计制作工具。程序内置了大量的实例模版,不管新手或专业用户都能轻松设计制作。除了内置大量的模版,BluffTitler iTV还支持大量的特效,比如各种纹理效果、各种扭曲效果、各种跳动飞行效果...
惠生活桌面管家是一款可以帮你管理桌面的工具帮你进行桌面分类,软件具有天气预报功能,随时关注实时天气,有需求的下载试试吧。 功能介绍 桌面管理 还嫌你... 动感的操作 软件操作采用3D动画效果,给你不一样的感受
Watery Desktop 3D v3.35 汉化安装版 系统平台:XP、WIN7(32位和64位) 告别传统的静态桌面,Watery Desktop 3D 在你的桌面上制造出生动的水纹效果。现在你不仅可以通过更换桌面壁纸来丰富你的视线,Watery Desktop...
2.增加页面3D过渡效果控制选项(能在原页面过渡效果基础上增强立体感)。 3.在高清设备和平板电脑上支持横竖屏切换。 4.设置菜单加入信息反馈通道。 5.TSF设置加入桌面配置备份功能(能备份或恢复桌面的布局和设置)。...
第20章 桌面类游戏——《激情台球》本章介绍了Android 3D游戏《激情台球》的开发。主要介绍了台球与台球的碰撞检测实现、台球与球桌的碰撞检测实现和进球的判定实现 第21章 射击类游戏——《抢滩登陆》本章介绍...
4、以上几种效果在一幅图像中的综合运用:用PSDTO3D软件伏做图,可以使立体、变画、动画、旋转、缩放等特殊效果同时在一幅画面中体现,具体做法是用上述方法分别做好各种效果,进行分组链接即可。 5、“文件”菜单...
flash模拟实现的windows界面效果,仿Windows操作系统的开始菜单、桌面以及各种窗口动画效果,比Windows界面要漂亮。
scrollreveal.js是一款可以轻易实现桌面和移动浏览器元素随页面滚动产生动画的js插件。该插件通过配置可以在页面滚动,元素进入视口时产生炫酷的动画效果,同时还支持元素的3D效果,非常的实用。
仿Vista的桌面主题很多,不过大多只是仿窗口样式或者透明任务栏之类,最吸引人的3D窗口切换功能很难找到。这个软件可以轻松实现此功能,耗资源很少,效果不错,并且是绿色软件,不用担心破坏系统设置。
OpenShot提供了无数的特性和功能,包括强大的基于曲线的关键帧动画,3D动画标题和效果,慢动作和时间效果,音频混合和编辑等等。它具有非常简单和友好的界面,可用于Linux,Mac和Windows。开始使用OpenShot轻松快速...
如今的软件市场,竞争已经进入白热化阶段,功能...然而使用传统的桌面应用程序开发工具和框架(如Winform、MFC、VB、Delphi等)进行开发时,为了使软件界面变漂亮、加入动画或者3D效果,边际成本会非常的高。体现在:资源
在windows平台基于VS2017嵌套Qt插件开发的一款桌面应用程序,程序整体架构采用插件框架,各摸块通过插件管理器与主系统进行通讯,主系统主要功能包含xmpp、Mqtt即时通讯,opencv视觉处理,vtk3D点云显示,WebEngine...
该项目已移至自己的网站... 动画,碰撞检测,3D声音。 可扩展的3D对象系统,具有开箱即用的关卡,物品,智能生物等。 桌面,移动,Web插件。 也是view3dscene的所在地-我们功能齐全的VRML / X3D浏览器。
{"取色器","图片压缩","屏幕截图","放大镜","WebView_JS交互","PhoneGap... "桌面弹性滑动效果实现","3D相册(重写Gallery)","Activity的切换动画效果","仿新浪微博向下拉动刷新功能","倒计时功能的实现CountDownTimer",
jq 3D旋转木马 jQuery QQ登陆框效果 jquery+css3时钟效果 jquery+css3曲线特效图: jquery仿wp动画悬浮标签云插件 jquery倒计时广告 jquery右侧悬浮在线客服代码 jquery坐标图片框裁剪 jquery多功能树插件 jquery...
在移动端和桌面/控制台上工作 2D和3D作品 与内置和URP(2D和正向渲染器)管道协同工作 优化的自定义着色器,具有多种效果(UV扭曲、溶解、阴影…) 摄像头抖动和动画灯光,具有场景视图预览功能 HDR效果与bloom后...