Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM5-10
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
YM5-10
Commits
a39e3835
Commit
a39e3835
authored
Jan 29, 2021
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:调整动画显示方式
parent
23b72a83
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
27 deletions
+53
-27
Exercises.spreat.ts
src/app/play/Exercises.spreat.ts
+49
-23
play.component.ts
src/app/play/play.component.ts
+4
-4
No files found.
src/app/play/Exercises.spreat.ts
View file @
a39e3835
...
...
@@ -62,6 +62,7 @@ export class Exercises {
this
.
initIndex
();
this
.
initCard
();
}
initBg
()
{
...
...
@@ -244,9 +245,9 @@ export class Exercises {
return
answer
;
}
getTextView2
(
letterArr
){
getTextView2
(
letterArr
)
{
let
getLabel
=
(
letter
,
fontColor
)
=>
{
let
getLabel
=
(
letter
,
fontColor
)
=>
{
const
label
=
new
Label
();
label
.
text
=
letter
;
...
...
@@ -268,11 +269,13 @@ export class Exercises {
let
x
=
0
;
let
tmpArr
=
[];
for
(
let
i
=
0
;
i
<
letterArr
.
length
;
++
i
)
{
let
letter
=
letterArr
[
i
];
if
(
!
letter
)
{
if
(
!
letter
)
{
continue
;
}
...
...
@@ -283,16 +286,20 @@ export class Exercises {
}
for
(
let
j
=
0
;
j
<
letter
.
val
.
length
;
++
j
)
{
for
(
let
j
=
0
;
j
<
letter
.
val
.
length
;
++
j
)
{
let
label
=
getLabel
(
letter
.
val
.
charAt
(
j
),
fontColor
);
label
.
x
=
x
;
x
+=
label
.
getBoundingBox
().
width
;
h
=
label
.
getBoundingBox
().
height
;
w
+=
label
.
getBoundingBox
().
width
;
bg
.
addChild
(
label
);
tmpArr
.
push
(
label
);
}
}
for
(
let
i
=
0
;
i
<
tmpArr
.
length
;
++
i
)
{
let
label
=
tmpArr
[
i
];
label
.
x
=
x
;
let
tW
=
Math
.
ceil
(
label
.
getBoundingBox
().
width
);
x
+=
tW
;
h
=
label
.
getBoundingBox
().
height
;
w
+=
tW
;
}
bg
.
alpha
=
0
;
...
...
@@ -334,11 +341,18 @@ export class Exercises {
let
text
=
this
.
getTextView2
(
answerData
.
letterArr
);
text
.
x
=
(
w
-
text
.
getBoundingBox
().
width
)
/
2
;
//text.y = h / 2 - 195 * this.scaleY + 325 * this.scaleY + text.getBoundingBox().height / 2;
text
.
y
=
h
/
2
-
195
*
this
.
scaleY
+
325
*
this
.
scaleY
;
text
.
alpha
=
0
;
let
text2
=
this
.
getTextView
(
answerData
.
letterArr
);
text2
.
y
=
h
/
2
-
195
*
this
.
scaleY
+
325
*
this
.
scaleY
+
text2
.
getBoundingBox
().
height
/
2
;
text2
.
x
=
text
.
x
;
text2
.
alpha
=
0
;
answerBg
.
addChild
(
text
);
answerBg
.
addChild
(
text2
);
answerBg
.
text
=
text
;
answerBg
.
text2
=
text2
;
}
else
{
pic
.
y
=
h
/
2
;
...
...
@@ -481,11 +495,13 @@ export class Exercises {
if
(
this
.
leftAnswer
.
line
)
{
this
.
leftAnswer
.
line
.
alpha
=
1
;
this
.
leftAnswer
.
text
.
visible
=
false
;
this
.
leftAnswer
.
text2
.
alpha
=
0
;
}
if
(
this
.
rightAnswer
.
line
)
{
this
.
rightAnswer
.
line
.
alpha
=
1
;
this
.
rightAnswer
.
text
.
visible
=
false
;
this
.
rightAnswer
.
text2
.
alpha
=
0
;
}
this
.
curCard
=
this
.
frontCard
;
...
...
@@ -495,29 +511,39 @@ export class Exercises {
}
textAnimal
(
text
,
callback
=
null
)
{
textAnimal
(
item
,
callback
=
null
)
{
let
labelArr
=
text
.
children
;
let
labelArr
=
item
.
text
.
children
;
const
animal
=
(
label
,
index
)
=>
{
tweenChange
(
label
,
{
y
:
label
.
y
-
12
*
this
.
scaleY
}
,
0.08
,
()
=>
{
tweenChange
(
label
,
{
y
:
label
.
y
-
12
*
this
.
scaleY
}
,
0.08
,
()
=>
{
let
i
=
index
+
1
;
if
(
labelArr
[
i
])
{
if
(
labelArr
[
i
])
{
animal
(
labelArr
[
i
],
i
);
}
tweenChange
(
label
,
{
y
:
label
.
y
+
16
*
this
.
scaleY
},
0.08
,
()
=>
{
tweenChange
(
label
,
{
y
:
label
.
y
-
4
*
this
.
scaleY
},
0.04
,
callback
);
tweenChange
(
label
,
{
y
:
label
.
y
+
16
*
this
.
scaleY
},
0.08
,
()
=>
{
tweenChange
(
label
,
{
y
:
label
.
y
-
4
*
this
.
scaleY
},
0.04
,
()
=>
{
if
(
callback
)
{
callback
();
if
(
index
==
labelArr
.
length
-
1
)
{
item
.
text2
.
alpha
=
1
;
item
.
text
.
visible
=
false
;
jelly
(
item
.
text2
,
0.7
)
}
}
});
});
});
}
item
.
text2
.
alpha
=
0
;
item
.
text
.
visible
=
true
;
animal
(
labelArr
[
0
],
0
);
}
...
...
src/app/play/play.component.ts
View file @
a39e3835
...
...
@@ -958,12 +958,12 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
item
.
line
.
alpha
==
1
){
item
.
line
.
alpha
=
0
;
item
.
text
.
visible
=
true
;
this
.
curExer
.
textAnimal
(
item
.
text
,
()
=>
{
this
.
curExer
.
textAnimal
(
item
,
()
=>
{
this
.
canTouch
=
true
;
})
}
else
{
this
.
curExer
.
textAnimal
(
item
.
text
,
()
=>
{
this
.
curExer
.
textAnimal
(
item
,
()
=>
{
this
.
canTouch
=
true
;
})
this
.
curAudio
=
this
.
playAudio
(
this
.
curExer
.
data
.
leftAnswer
.
audioUrl
,
true
);
...
...
@@ -985,13 +985,13 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
item
.
line
.
alpha
==
1
){
item
.
line
.
alpha
=
0
;
item
.
text
.
visible
=
true
;
this
.
curExer
.
textAnimal
(
item
.
text
,
()
=>
{
this
.
curExer
.
textAnimal
(
item
,
()
=>
{
this
.
canTouch
=
true
;
})
}
else
{
this
.
curExer
.
textAnimal
(
item
.
text
,
()
=>
{
this
.
curExer
.
textAnimal
(
item
,
()
=>
{
this
.
canTouch
=
true
;
})
this
.
curAudio
=
this
.
playAudio
(
this
.
curExer
.
data
.
rightAnswer
.
audioUrl
,
true
);
...
...
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