Animation动画配置文件原来还可以设置加上p去,加了p后,移动就是从屏幕边开始一直移动到指定的地方。
效果图:
代码很简单:
(1)MainActivity.java
package com.example.animationtest; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.TextView; public class MainActivity extends Activity { private TextView textView = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView) findViewById(R.id.hello_tv); /** * 点击出动画 */ View testButton = findViewById(R.id.hello_btn); testButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.slide_left_in); textView.startAnimation(animation); } }); } }
(2)布局activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:id="@+id/hello_tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:layout_centerInParent="true" /> <Button android:id="@+id/hello_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" android:text="测试动画" /> </RelativeLayout>
(3)左平移slide_left_in.xml(这里很关键,当设值android:fromXDelta带p时,平移是从屏幕最右侧一直滑动到控件所停位置,不带p就只滑动一个控件的宽度)
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="200" android:fromXDelta="100.0%p" android:toXDelta="0.0" /> </set>
相关推荐
unity动画转换插件 Animation_Converter_1.02p03.unitypackage
强大的动画编辑器能在 Unity 中动画绘制任何类型的 3D 模型。 甚至可以在播放模式下细调动画效果来减少开发时间。 无 CPU 开销:UMotion 生成的 Unity 动画剪辑不需要运行时组件。 PRO 功能 ⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺...
引擎内动画编辑器。
强大的动画编辑器能在 Unity 中动画绘制任何类型的 3D 模型。 甚至可以在播放模式下细调动画效果来减少开发时间。 无 CPU 开销:UMotion 生成的 Unity 动画剪辑不需要运行时组件。 PRO 功能 新特性:FBX 导出...
Down>Forward>P) for advanced combo creations –Sync-Activators– Combine inputs to trigger simultaneously (eg. A+S pressed together) for advanced combo creations –Multiplayer Support– Setup ...
div 加P标签实现简单动画,备用,通过animation,-webkit-transform 实现p标签的运动动画
iTween动画插件很好用的。 iTween是一个动画库,作者创建它的目的就是最小的投入实现最大的产出.让你做开发更轻松,用它可以轻松实现各种动画,晃动,旋转,移动,褪色,上色,控制音频等等.
android上的3d图形效果,使用camera类实现。
动画Android 在Android中支持APNG和Webp和Gif动画 高效解码器 支持Drawable用法和滑动库模块 支持动画播放控制 支持静止图像 内存使用率低 用法 在build.gradle中添加依赖项 repositories { mavenCentral() } WebP...
Android下补间动画demo,详细参见博客:http://www.cnblogs.com/plokmju/p/android_TweenAnimation.html
可轻松处理滚动输入动画用法安装软件包npm install entry-animation-web-component 在您的项目中包含dist/js/entry-animation.min.js 在HTML中使用元素: <entry> <article> <h2>Elements <p>Put here elements to ...
主要是对CAKeyframeAnimation关键帧动画的使用,和scenekit实现的飞机游戏。具体分析请看博客:https://www.jianshu.com/p/15c52986ab6e 由于代码文件大于5M,无法上传,请去我的git仓库下载: 地址:...
1、实现两个animation xml文件,一个起始位置在-100%p ,一个在0%p。设置repeat属性为循环,重复。 代码如下: <?xml version=”1.0″ encoding=”utf-8″?> ”http://schemas.android.com/apk/res/android” ...
Android下逐帧动画的Demo,详细参见博客:http://www.cnblogs.com/plokmju/p/android_AnimationDrawable.html
t(k+1) % x = [NxM] 状态矩阵,对应于 t 中的时间% P = 动画参数结构,带字段: % .plotFunc = @(t,x) = 创建绘图的函数句柄% t = 标量时间% x = [Nx1] 状态向量% .figNum =(可选)用于绘图的图形编号。...
AnimationThread是动画的控制线程,设计成单例。Animatable是驱动动画所需要的接口。AnimationThread管理了一个Animatable的列表,往列表中添加Animatable时,将启动动画线程,当列表为空时,将停止这个线程,避免...
使next.js的页面转换更容易|让next.js的页面切换动画更简单 快速浏览 用法使用方法 组件/wrapper.js import w from 'next-page-transition' import { zoomfade } from 'next-page-transition/dist/presets' export...
俄罗斯方块动画 Arduino库,用于使用下降块样式动画绘制字母和数字。 最初是为RGB LED矩阵... PxMATRIX display(64, 32, P_LAT, P_OE, P_A, P_B, P_C, P_D, P_E); //Intialise any display that makes use of Adafrui
new AnimateInventory("§cTest animation", 27, p, getFrames(), 1, true, false); 第一个参数是GUI的标题 第二个是插槽数(27个是简单的箱子) 第三是分配给GUI的播放器 第四是库存的所有框架(转到步骤2了解) ...