一个优雅的代码动画库。支持直接函数调用和链式调用。内部封装Tween来作为动画内核。
接下来介绍 <链式动画> 和 <action动画> 的使用方式。
链式使用方式 kotlin使用方式请进入
//当前为java代码
//执行渐入动画
new SequenceActionRunBuild(view)
.fadeIn(time)
.start()
//执行渐入动画
new SequenceActionRunBuild(view)
.fadeOut(time)
.start()
//指定透明度
new SequenceActionRunBuild(view)
.fadeTo(time,0f) //透明度传入 0-1
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//执行渐入动画
RunAction.INSTANCE.runAction(view, Action.fadeIn(time))
//执行渐出动画
RunAction.INSTANCE.runAction(view, Action.fadeOut(time))
//指定透明度
RunAction.INSTANCE.runAction(view, Action.fadeTo(time,0f))//透明度传入 0-1
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//位移到指定位置
new SequenceActionRunBuild(view)
.moveTo(time,x,y)
.start()
//根据当前位置,位移偏移
new SequenceActionRunBuild(view)
.moveBy(time,x,y)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//位移到指定位置
RunAction.INSTANCE.runAction(view, Action.moveTo(time,x,y))
//根据当前位置,位移偏移
RunAction.INSTANCE.runAction(view, Action.moveBy(time,x,y))
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//缩放到指定大小
new SequenceActionRunBuild(view)
.scaleTo(time,x,y)
.start()
//根据当前大小,大小偏移
new SequenceActionRunBuild(view)
.scaleBy(time,x,y)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//缩放到指定大小
RunAction.INSTANCE.runAction(view, Action.scaleTo(time,x,y))
//根据当前大小,大小偏移
RunAction.INSTANCE.runAction(view, Action.scaleBy(time,x,y))
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//旋转到指定角度
new SequenceActionRunBuild(view)
.rotateTo(time,rotation)
.start()
//根据当前角度,角度偏移
new SequenceActionRunBuild(view)
.rotateBy(time,rotation)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//旋转到指定角度
RunAction.INSTANCE.runAction(view, Action.rotateTo(time,rotation))
//根据当前角度,角度偏移
RunAction.INSTANCE.runAction(view, Action.rotateBy(time,rotation))
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//旋转到指定角度
new SequenceActionRunBuild(view)
.rotateXTo(time,rotateX)
.start()
//根据当前角度,角度偏移
new SequenceActionRunBuild(view)
.rotateXBy(time,rotateX)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//旋转到指定角度
RunAction.INSTANCE.runAction(view, Action.rotateXTo(time,rotateX))
//根据当前角度,角度偏移
RunAction.INSTANCE.runAction(view, Action.rotateXBy(time,rotateX))
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//旋转到指定角度
new SequenceActionRunBuild(view)
.rotateYTo(time,rotateY)
.start()
//根据当前角度,角度偏移
new SequenceActionRunBuild(view)
.rotateYBy(time,rotateY)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//旋转到指定角度
RunAction.INSTANCE.runAction(view, Action.rotateYTo(time,rotateY))
//根据当前角度,角度偏移
RunAction.INSTANCE.runAction(view, Action.rotateYBy(time,rotateY))
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//透明度渐入后渐出
new SequenceActionRunBuild(view)
.fadeIn(time)
.fadeOut(time)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//透明度渐入后渐出
RunAction.INSTANCE.runAction(view, Action.sequence(Action.fadeIn(time), Action.fadeOut(time)))
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//同时执行位移和旋转动画
new SpawnActionRunBuild(view)
.moveBy(time, x, y)
.rotateBy(time, rotation)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//同时执行位移和旋转动画
RunAction.INSTANCE.runAction(view,
Action.spawn(
Action.moveBy(time, x, y),
Action.rotateBy(time, rotation)
)
)
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//渐入后 执行打印
new SequenceActionRunBuild(view)
.fadeIn(time)
.callFunc(() -> {
Log.i(CallbackActivity.this.getClass().getName(),"fadeIn 执行完成");
return null;
})
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//渐入后 执行打印
RunAction.INSTANCE.runAction(runView, Action.INSTANCE.sequence(Action.INSTANCE.fadeIn(time), Action.INSTANCE.callFunc(() -> {
Log.i(CallbackActivity.this.getClass().getName(),"fadeIn 执行完成");
return null;
})));
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
链式使用方式 kotlin使用方式请进入
//当前为java代码
//等待1秒后执行渐入
new SequenceActionRunBuild(view)
.wait(1000)
.fadeIn(time)
.start()
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
runAction使用方式 kotlin使用方式请进入
//当前为java代码
//等待1秒后执行渐入
RunAction.INSTANCE.runAction(view, Action.sequence(Action.wait(1000),Action.fadeIn(time)))
停止动画
//当前为java代码
RunAction.INSTANCE.stopAction(view)
缓动函数计算引用 tween.js 的缓动函数。
默认的缓动函数为 Easing.linear()
链式使用方式 kotlin使用方式请进入
//当前为java代码
new SequenceActionRunBuild(view)
.fadeIn(time,Easing.linear()) //使用线性缓动函数
.start()
runAction使用方式 kotlin使用方式请进入
//当前为java代码
RunAction.INSTANCE.runAction(view, Action.fadeIn(time,Easing.linear())) //使用线性缓动函数
设置全部动画的速度为1倍
//设置全部动画的速度为1倍
TweenManager.speed = 1.0
设置动画全局暂停
//设置动画全局暂停
TweenManager.pause()
设置动画全局恢复
//设置动画全局恢复
TweenManager.pause()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。