Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DF-L211
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
DF-L211
Commits
58646637
Commit
58646637
authored
Jun 01, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加小手提示
parent
7748124c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
12 deletions
+73
-12
AudioAnimation.ts
src/app/play/AudioAnimation.ts
+56
-11
play.component.ts
src/app/play/play.component.ts
+15
-1
resources.js
src/app/play/resources.js
+2
-0
finger.png
src/assets/play/finger.png
+0
-0
No files found.
src/app/play/AudioAnimation.ts
View file @
58646637
...
...
@@ -11,7 +11,7 @@ export class AudioAnimation {
images
=
new
Map
();
bg
:
ShapeRect
;
bg
:
ShapeRect
;
scaleX
=
1
;
...
...
@@ -29,6 +29,8 @@ export class AudioAnimation {
hideFlag
=
true
;
fingerPic
;
/**
* 设置播放帧图片
* @param images
...
...
@@ -38,7 +40,7 @@ export class AudioAnimation {
this
.
images
=
images
;
}
setXY
(
x
,
y
){
setXY
(
x
,
y
)
{
this
.
x
=
x
;
this
.
y
=
y
;
}
...
...
@@ -56,6 +58,10 @@ export class AudioAnimation {
return
;
}
this
.
scaleX
=
scaleX
;
this
.
scaleY
=
sacleY
;
const
bg
=
new
ShapeRect
();
const
getAudioPic
=
(
index
)
=>
{
...
...
@@ -71,7 +77,7 @@ export class AudioAnimation {
};
const
playPic1
=
getAudioPic
(
1
);
if
(
show
)
{
playPic1
.
alpha
=
1
;
...
...
@@ -90,7 +96,7 @@ export class AudioAnimation {
const
playPic3
=
getAudioPic
(
3
);
this
.
playPic3
=
playPic3
;
bg
.
setSize
(
playPic1
.
getBoundingBox
().
width
,
playPic1
.
getBoundingBox
().
height
);
bg
.
alpha
=
0
;
this
.
bg
=
bg
;
...
...
@@ -104,6 +110,16 @@ export class AudioAnimation {
parent
.
addChild
(
bg
);
}
const
finger
=
new
MySprite
();
finger
.
init
(
this
.
images
.
get
(
"
finger
"
),
0
,
0
);
finger
.
scaleX
=
this
.
scaleX
;
finger
.
scaleY
=
this
.
scaleY
;
finger
.
alpha
=
0
;
this
.
fingerPic
=
finger
;
finger
.
x
=
bg
.
width
;
finger
.
y
=
bg
.
height
;
this
.
fingerPic
.
canShow
=
true
;
bg
.
addChild
(
finger
);
}
/**
...
...
@@ -115,13 +131,13 @@ export class AudioAnimation {
const
setPause
=
()
=>
{
if
(
this
.
hideFlag
)
{
if
(
this
.
hideFlag
)
{
this
.
playPic1
.
alpha
=
0
;
}
else
{
else
{
this
.
playPic1
.
alpha
=
1
;
}
this
.
playPic2
.
alpha
=
0
;
this
.
playPic3
.
alpha
=
0
;
}
...
...
@@ -194,14 +210,14 @@ export class AudioAnimation {
this
.
curAudio
=
audio
;
audio
.
onended
=
()
=>
{
this
.
playing
=
false
;
if
(
callback
)
{
callback
();
}
};
audio
.
play
();
this
.
playing
=
true
;
...
...
@@ -252,7 +268,7 @@ export class AudioAnimation {
/**
* 显示播放动画
*/
show
(){
show
()
{
this
.
hideFlag
=
false
;
...
...
@@ -260,4 +276,33 @@ export class AudioAnimation {
this
.
playPic2
.
alpha
=
0
;
this
.
playPic3
.
alpha
=
0
;
}
showFinger
()
{
if
(
!
this
.
fingerPic
.
canShow
)
{
return
;
}
this
.
fingerPic
.
alpha
=
1
;
let
sX
=
this
.
fingerPic
.
x
;
let
sY
=
this
.
fingerPic
.
y
;
let
toX
=
this
.
bg
.
width
/
2
;
let
toY
=
this
.
bg
.
height
/
2
;
tweenChange
(
this
.
fingerPic
,
{
x
:
toX
,
y
:
toY
},
0.5
,
()
=>
{
tweenChange
(
this
.
fingerPic
,
{
alpha
:
0
},
0.2
,
()
=>
{
this
.
fingerPic
.
x
=
sX
;
this
.
fingerPic
.
y
=
sY
;
setTimeout
(()
=>
{
this
.
showFinger
();
},
100
);
})
});
}
hideFinger
(){
this
.
fingerPic
.
canShow
=
false
;
}
}
\ No newline at end of file
src/app/play/play.component.ts
View file @
58646637
...
...
@@ -838,9 +838,13 @@ export class PlayComponent implements OnInit, OnDestroy {
showNextExercise
()
{
let
exercise
=
this
.
tempExerciseArr
.
shift
();
this
.
audioTool
.
pauseAudio
();
//如果存在,则加载;不存在,则表示结束
if
(
exercise
)
{
this
.
canPlay
=
false
;
this
.
curIndex
+=
1
;
this
.
stage
.
setPromptText
(
this
.
curIndex
+
"
/
"
+
this
.
exerciseArr
.
length
);
...
...
@@ -854,7 +858,9 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
i
==
0
)
{
this
.
leftBox
.
showBox
(
answers
[
i
],
()
=>
{
this
.
canTouch
=
true
;
this
.
canPlay
=
true
;
this
.
audioTool
.
fingerPic
.
canShow
=
true
;
this
.
audioTool
.
showFinger
();
});
}
else
if
(
i
==
1
)
{
...
...
@@ -896,6 +902,10 @@ export class PlayComponent implements OnInit, OnDestroy {
let
audio
=
this
.
curExercise
.
listeningAudio
;
this
.
audioTool
.
playAudio
(
audio
,
true
);
this
.
audioTool
.
hideFinger
();
this
.
canPlay
=
true
;
}
}
...
...
@@ -977,6 +987,10 @@ export class PlayComponent implements OnInit, OnDestroy {
clickBox
(
box
)
{
if
(
!
this
.
canPlay
){
return
;
}
this
.
canTouch
=
false
;
box
.
click
(()
=>
{
...
...
src/app/play/resources.js
View file @
58646637
...
...
@@ -25,6 +25,8 @@ const res = [
[
'
player
'
,
'
assets/play/player.png
'
],
[
'
sweat
'
,
'
assets/play/sweat.png
'
],
[
'
finger
'
,
'
assets/play/finger.png
'
],
[
'
petal_1
'
,
"
assets/play/petal_1.png
"
],
[
'
petal_2
'
,
"
assets/play/petal_2.png
"
],
[
'
petal_3
'
,
"
assets/play/petal_3.png
"
],
...
...
src/assets/play/finger.png
0 → 100644
View file @
58646637
9.81 KB
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