Commit 8dcb843a authored by Chen Jiping's avatar Chen Jiping

完善

parent cab02632
...@@ -96,7 +96,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -96,7 +96,7 @@ export class PlayComponent implements OnInit, OnDestroy {
cardOuterR = 90; cardOuterR = 90;
//卡片内半径 //卡片内半径
cardInerR = 80; cardInerR = 70;
maxWidth = 450; maxWidth = 450;
...@@ -115,6 +115,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -115,6 +115,9 @@ export class PlayComponent implements OnInit, OnDestroy {
//练习题内容 //练习题内容
curContents = []; curContents = [];
//练习题临时数组,用于随机取数
tempContents = [];
curContent; curContent;
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
...@@ -603,9 +606,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -603,9 +606,9 @@ export class PlayComponent implements OnInit, OnDestroy {
const s = Math.min(sx, sy); const s = Math.min(sx, sy);
this.mapScale = s; this.mapScale = s;
this.cardOuterR = 90 * this.mapScale; this.cardOuterR = this.cardOuterR * this.mapScale;
this.cardInerR = 80 * this.mapScale; this.cardInerR = this.cardInerR * this.mapScale;
this.renderArr = []; this.renderArr = [];
...@@ -800,6 +803,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -800,6 +803,8 @@ export class PlayComponent implements OnInit, OnDestroy {
tContent.audio_url = content.audio_url; tContent.audio_url = content.audio_url;
this.curContents.push(tContent); this.curContents.push(tContent);
this.tempContents.push(tContent);
} }
//计算角度 //计算角度
...@@ -938,7 +943,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -938,7 +943,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let d = Math.sqrt( w * w + h * h); let d = Math.sqrt( w * w + h * h);
content_pic.setScaleXY((contentCard.width - 60) / d); content_pic.setScaleXY((contentCard.width - 75) / d);
content_pic.x = 0; content_pic.x = 0;
content_pic.y = 0; content_pic.y = 0;
...@@ -1066,7 +1071,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1066,7 +1071,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let y = itemPic.y; let y = itemPic.y;
console.log('card ', itemPic); //console.log('card ', itemPic);
//设置阴影 //设置阴影
if(y > -30){ if(y > -30){
...@@ -1242,6 +1247,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1242,6 +1247,14 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
this.shadows = []; this.shadows = [];
//临时数组为空,则重新设置数据
if(!this.tempContents || this.tempContents.length == 0){
console.log('reset temp contntes');
for(let i = 0; i < this.curContents.length; ++ i){
this.tempContents.push(this.curContents[i]);
}
}
} }
} }
...@@ -1297,7 +1310,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1297,7 +1310,7 @@ export class PlayComponent implements OnInit, OnDestroy {
//音频长度 //音频长度
const audio = this.audioObj['playing']; const audio = this.audioObj['playing'];
let duration = Math.ceil(audio.duration); let duration = audio.duration;
let angle = duration * 20 * this.temp_multiple; let angle = duration * 20 * this.temp_multiple;
...@@ -1346,7 +1359,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1346,7 +1359,9 @@ export class PlayComponent implements OnInit, OnDestroy {
shadow.pic.setScaleXY(shadow.scale); shadow.pic.setScaleXY(shadow.scale);
} }
this.curContent = this.getRandomItemFromArr(this.curContents); this.curContent = this.getRandomItemFromArr(this.tempContents);
removeItemFromArr(this.tempContents, this.curContent);
this.curContent.card_choice.alpha = 1; this.curContent.card_choice.alpha = 1;
//this.curContent.card_show.alpha = 0; //this.curContent.card_show.alpha = 0;
...@@ -1371,16 +1386,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1371,16 +1386,22 @@ export class PlayComponent implements OnInit, OnDestroy {
return; return;
} }
let time = 0.1;
if(duration < time){
time = duration;
}
let t_angle = angle % 360; let t_angle = angle % 360;
item.rotation = t_angle; item.rotation = t_angle;
t_angle = t_angle + duration * 20 * this.temp_multiple; t_angle = t_angle + duration * 20 * this.temp_multiple;
rotateItem(item, t_angle, 0.2,()=>{ rotateItem(item, t_angle, time,()=>{
this.rotate(item, t_angle, duration - 0.2, callback); this.rotate(item, t_angle, duration - time, callback);
}); });
......
src/assets/play/bg.png

447 KB | W: | H:

src/assets/play/bg.png

520 KB | W: | H:

src/assets/play/bg.png
src/assets/play/bg.png
src/assets/play/bg.png
src/assets/play/bg.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/btn_go.png

6.31 KB | W: | H:

src/assets/play/btn_go.png

8.18 KB | W: | H:

src/assets/play/btn_go.png
src/assets/play/btn_go.png
src/assets/play/btn_go.png
src/assets/play/btn_go.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment