Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
418087cf
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1598
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
418087cf
编写于
12月 22, 2022
作者:
打打卡夫卡
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改 语法用法
上级
80d2d3ad
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
71 deletion
+79
-71
pages/SDKIntegration/Lottie/index.nvue
pages/SDKIntegration/Lottie/index.nvue
+11
-16
uni_modules/uts-animation-view/utssdk/app-android/assets/anim_a.json
.../uts-animation-view/utssdk/app-android/assets/anim_a.json
+0
-0
uni_modules/uts-animation-view/utssdk/app-android/assets/anim_b.json
.../uts-animation-view/utssdk/app-android/assets/anim_b.json
+0
-0
uni_modules/uts-animation-view/utssdk/app-android/index.vue
uni_modules/uts-animation-view/utssdk/app-android/index.vue
+68
-55
未找到文件。
pages/SDKIntegration/Lottie/index.nvue
浏览文件 @
418087cf
<template>
<div>
<button @tap="change
Hiden">测试隐藏组件
</button>
<button @tap="updateStyle" :style="{width:widthNum+'px',height:heightNum+'px',background:yanse}">测试更新样式
</button>
<button @tap="changeUrl">测试更新动画链接</button>
<button @tap="change
Url">播放本地动画资源
</button>
<button @tap="changeServerUrl">播放远程动画资源
</button>
<button @tap="changeAutoPlay">测试AutoPlay</button>
<button @tap="changeLoop">测试Loop</button>
<button @tap="changeAction(1)">测试action play</button>
...
...
@@ -26,8 +26,8 @@
action: "play",
loop: false,
yanse: "red",
widthNum:
200
,
heightNum:
1
00,
widthNum:
375
,
heightNum:
2
00,
comShow: true,
animUrl: "AndroidWave.json"
}
...
...
@@ -35,25 +35,20 @@
methods: {
updateStyle: function() {
this.heightNum = 200
this.widthNum = 300
this.yanse = "green"
},
changeHiden: function() {
this.hidden = !this.hidden
},
changeAutoPlay: function() {
this.autoplay = !this.autoplay
},
changeUrl: function() {
if (this.animUrl == "
zy_lottie_live
.json") {
this.animUrl = "
AndroidWave
.json"
if (this.animUrl == "
anim_a
.json") {
this.animUrl = "
anim_b
.json"
} else {
this.animUrl = "
zy_lottie_live
.json"
this.animUrl = "
anim_a
.json"
}
},
changeServerUrl: function() {
this.animUrl = "https://b.bdstatic.com/miniapp/images/lottie_example_one.json"
},
changeAction: function(type) {
if (type == 1) {
this.action = "play"
...
...
uni_modules/uts-animation-view/utssdk/app-android/assets/
AndroidWave
.json
→
uni_modules/uts-animation-view/utssdk/app-android/assets/
anim_a
.json
浏览文件 @
418087cf
文件已移动
uni_modules/uts-animation-view/utssdk/app-android/assets/
zy_lottie_live
.json
→
uni_modules/uts-animation-view/utssdk/app-android/assets/
anim_b
.json
浏览文件 @
418087cf
文件已移动
uni_modules/uts-animation-view/utssdk/app-android/index.vue
浏览文件 @
418087cf
...
...
@@ -86,45 +86,51 @@
"
path
"
:
{
handler
(
newPath
:
string
)
{
let
lottieAnimationView
=
this
.
$el
if
(
lottieAnimationView
!=
null
&&
!
TextUtils
.
isEmpty
(
newPath
))
{
if
(
newPath
.
startsWith
(
"
http://
"
)
||
newPath
.
startsWith
(
"
https://
"
))
{
lottieAnimationView
.
setAnimationFromUrl
(
newPath
)
}
else
{
// 默认是asset了
lottieAnimationView
.
setAnimation
(
newPath
)
}
}
if
(
this
.
autoplay
)
{
lottieAnimationView
.
playAnimation
()
}
if
(
this
.
$el
!=
null
){
let
lottieAnimationView
=
this
.
$el
if
(
!
TextUtils
.
isEmpty
(
newPath
))
{
if
(
newPath
.
startsWith
(
"
http://
"
)
||
newPath
.
startsWith
(
"
https://
"
))
{
lottieAnimationView
.
setAnimationFromUrl
(
newPath
)
}
else
{
// 默认是asset了
lottieAnimationView
.
setAnimation
(
newPath
)
}
}
if
(
this
.
autoplay
)
{
lottieAnimationView
.
playAnimation
()
}
}
},
immediate
:
false
//创建时是否通过此方法更新属性,默认值为false
},
"
loop
"
:
{
handler
(
newLoop
:
Boolean
)
{
if
(
newLoop
)
{
this
.
$el
.
repeatCount
=
Int
.
MAX_VALUE
}
else
{
// 不循环则设置成1次
this
.
$el
.
repeatCount
=
0
}
if
(
this
.
autoplay
)
{
this
.
$el
.
playAnimation
()
}
if
(
this
.
$el
!=
null
){
if
(
newLoop
)
{
this
.
$el
.
repeatCount
=
Int
.
MAX_VALUE
}
else
{
// 不循环则设置成1次
this
.
$el
.
repeatCount
=
0
}
if
(
this
.
autoplay
)
{
this
.
$el
.
playAnimation
()
}
}
},
immediate
:
false
//创建时是否通过此方法更新属性,默认值为false
},
"
autoplay
"
:
{
handler
(
newValue
:
boolean
)
{
if
(
newValue
)
{
this
.
$el
.
playAnimation
()
}
if
(
this
.
$el
!=
null
){
if
(
newValue
)
{
this
.
$el
.
playAnimation
()
}
}
},
immediate
:
false
//创建时是否通过此方法更新属性,默认值为false
},
...
...
@@ -134,15 +140,17 @@
if
(
newAction
==
"
play
"
||
newAction
==
"
pause
"
||
newAction
==
"
stop
"
)
{
if
(
this
.
action
==
"
play
"
)
{
this
.
$el
.
playAnimation
()
}
else
if
(
this
.
action
==
"
play
"
)
{
this
.
$el
.
pauseAnimation
()
}
else
if
(
this
.
action
==
"
stop
"
)
{
this
.
$el
.
cancelAnimation
()
this
.
$el
.
clearAnimation
()
}
if
(
this
.
$el
!=
null
){
if
(
this
.
action
==
"
play
"
)
{
this
.
$el
.
playAnimation
()
}
else
if
(
this
.
action
==
"
pause
"
)
{
this
.
$el
.
pauseAnimation
()
}
else
if
(
this
.
action
==
"
stop
"
)
{
this
.
$el
.
cancelAnimation
()
this
.
$el
.
clearAnimation
()
}
}
}
else
{
// 非法入参,不管
...
...
@@ -153,12 +161,13 @@
"
hidden
"
:
{
handler
(
newValue
:
boolean
)
{
console
.
log
(
'
hidden
'
,
newValue
)
if
(
newValue
)
{
this
.
$el
.
visibility
=
View
.
GONE
}
else
{
this
.
$el
.
visibility
=
View
.
VISIBLE
}
if
(
this
.
$el
!=
null
){
if
(
newValue
)
{
this
.
$el
.
visibility
=
View
.
GONE
}
else
{
this
.
$el
.
visibility
=
View
.
VISIBLE
}
}
},
immediate
:
false
//创建时是否通过此方法更新属性,默认值为false
},
...
...
@@ -166,11 +175,13 @@
},
methods
:
{
setRepeatMode
(
repeat
:
string
)
{
if
(
"
RESTART
"
==
repeat
)
{
this
.
$el
.
repeatMode
=
LottieDrawable
.
RESTART
}
else
if
(
"
REVERSE
"
==
repeat
)
{
this
.
$el
.
repeatMode
=
LottieDrawable
.
RESTART
}
if
(
this
.
$el
!=
null
){
if
(
"
RESTART
"
==
repeat
)
{
this
.
$el
.
repeatMode
=
LottieDrawable
.
RESTART
}
else
if
(
"
REVERSE
"
==
repeat
)
{
this
.
$el
.
repeatMode
=
LottieDrawable
.
RESTART
}
}
},
privateMethod
()
{
//如何定义不对外暴露的API? 暂不支持,需在export外写
}
...
...
@@ -183,16 +194,18 @@
},
NVLoad
():
LottieAnimationView
{
//创建原生View,必须定义返回值类型(Android需要明确知道View类型,需特殊校验)
//必须实现
let
lottieAnimationView
=
new
LottieAnimationView
(
this
.
$androidContext
)
let
lottieAnimationView
=
new
LottieAnimationView
(
$androidContext
)
return
lottieAnimationView
},
NVLoaded
()
{
//原生View已创建
//可选实现,这里可以做后续操作
this
.
$el
.
repeatMode
=
LottieDrawable
.
RESTART
;
this
.
$el
.
visibility
=
View
.
GONE
this
.
$el
.
repeatCount
=
0
this
.
$el
.
addAnimatorListener
(
new
CustomAnimListener
(
this
))
//可选实现,这里可以做后续操作
if
(
this
.
$el
!=
null
){
this
.
$el
.
repeatMode
=
LottieDrawable
.
RESTART
;
this
.
$el
.
visibility
=
View
.
GONE
this
.
$el
.
repeatCount
=
0
this
.
$el
.
addAnimatorListener
(
new
CustomAnimListener
(
this
))
}
},
NVLayouted
()
{
//原生View布局完成
//可选实现,这里可以做布局后续操作
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录