Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSAPP2501
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
SSAPP2501
Commits
42b79416
Commit
42b79416
authored
Aug 03, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动画增加
parent
b659e3a4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
3 deletions
+97
-3
SSAPP2501.fire
assets/SSAPP2501/scene/SSAPP2501.fire
+3
-3
SSAPP2501.ts
assets/SSAPP2501/scene/SSAPP2501.ts
+94
-0
No files found.
assets/SSAPP2501/scene/SSAPP2501.fire
View file @
42b79416
...
...
@@ -6903,7 +6903,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
3.936
,
-
5
,
-353.105,
0,
0,
...
...
@@ -7091,7 +7091,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
3.93
6,
-6,
-353.105,
0,
0,
...
...
@@ -7199,7 +7199,7 @@
"__id__": 156
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
{
"__id__": 158
...
...
assets/SSAPP2501/scene/SSAPP2501.ts
View file @
42b79416
...
...
@@ -489,6 +489,90 @@ export default class SceneComponent extends MyCocosSceneComponent {
* @param hide 是否隐藏卡片,默认为false(显示)
* @param recordState 录音状态,可选值:'init'(初始状态), 'recording'(录制中), 'recorded'(录制完成)
*/
/**
* 播放录音动画效果
* 循环显示btn_record_0~btn_record_2三个按钮,实现录音中的动画效果
*/
playVoiceAni
()
{
// 获取录音按钮节点
let
btn_record_0
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_0
'
);
let
btn_record_1
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_1
'
);
let
btn_record_2
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_2
'
);
// 确保所有按钮都存在
if
(
!
btn_record_0
||
!
btn_record_1
||
!
btn_record_2
)
{
return
this
.
log
(
'
录音按钮节点不存在
'
);
}
// 初始状态:显示第一个按钮,隐藏其他按钮
btn_record_0
.
active
=
true
;
btn_record_1
.
active
=
false
;
btn_record_2
.
active
=
false
;
// 清除可能存在的旧定时器
if
(
this
.
_voiceAniTimer
)
{
clearInterval
(
this
.
_voiceAniTimer
);
this
.
_voiceAniTimer
=
null
;
}
// 当前显示的按钮索引
let
currentIndex
=
0
;
// 创建定时器,每隔200毫秒切换一次按钮显示
this
.
_voiceAniTimer
=
setInterval
(()
=>
{
// 隐藏所有按钮
btn_record_0
.
active
=
false
;
btn_record_1
.
active
=
false
;
btn_record_2
.
active
=
false
;
// 根据当前索引显示对应按钮
switch
(
currentIndex
)
{
case
0
:
btn_record_0
.
active
=
true
;
break
;
case
1
:
btn_record_1
.
active
=
true
;
break
;
case
2
:
btn_record_2
.
active
=
true
;
break
;
}
// 更新索引,循环显示三个按钮
currentIndex
=
(
currentIndex
+
1
)
%
3
;
},
200
);
}
/**
* 停止录音动画效果
* 停止按钮切换,只显示btn_record_0
*/
stopVoiceAni
()
{
// 清除定时器
if
(
this
.
_voiceAniTimer
)
{
clearInterval
(
this
.
_voiceAniTimer
);
this
.
_voiceAniTimer
=
null
;
}
// 获取录音按钮节点
let
btn_record_0
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_0
'
);
let
btn_record_1
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_1
'
);
let
btn_record_2
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_record_2
'
);
// 确保所有按钮都存在
if
(
!
btn_record_0
||
!
btn_record_1
||
!
btn_record_2
)
{
return
this
.
log
(
'
录音按钮节点不存在
'
);
}
// 只显示第一个按钮,隐藏其他按钮
btn_record_0
.
active
=
true
;
btn_record_1
.
active
=
false
;
btn_record_2
.
active
=
false
;
}
// 录音动画定时器
private
_voiceAniTimer
:
any
=
null
;
showCard
(
hide
:
boolean
=
false
,
recordState
:
string
=
'
init
'
)
{
if
(
!
hide
)
{
// 显示卡片
...
...
@@ -518,28 +602,38 @@ export default class SceneComponent extends MyCocosSceneComponent {
btn_stop
.
active
=
false
;
btn_start_reset
.
active
=
false
;
btn_record_replay
.
active
=
false
;
// 停止录音动画,显示初始状态
this
.
stopVoiceAni
();
break
;
case
'
recording
'
:
// 录制中
btn_start
.
active
=
false
;
btn_stop
.
active
=
true
;
btn_start_reset
.
active
=
false
;
btn_record_replay
.
active
=
false
;
// 开始播放录音动画
this
.
playVoiceAni
();
break
;
case
'
recorded
'
:
// 录制完成
btn_start
.
active
=
false
;
btn_stop
.
active
=
false
;
btn_start_reset
.
active
=
true
;
btn_record_replay
.
active
=
true
;
// 停止录音动画,显示初始状态
this
.
stopVoiceAni
();
break
;
default
:
// 默认显示初始状态
btn_start
.
active
=
true
;
btn_stop
.
active
=
false
;
btn_start_reset
.
active
=
false
;
btn_record_replay
.
active
=
false
;
// 停止录音动画,显示初始状态
this
.
stopVoiceAni
();
}
}
else
{
// 隐藏录音界面
this
.
layout_speak
.
active
=
false
;
// 停止录音动画
this
.
stopVoiceAni
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment