Fix Go-Go Time animation speed

This commit is contained in:
LoveEevee 2018-09-20 16:11:19 +03:00
parent e3af27f23c
commit f8b81a9795
2 changed files with 28 additions and 25 deletions

View File

@ -714,6 +714,7 @@ class View{
toggleGogoTime(circle){ toggleGogoTime(circle){
this.gogoTime = circle.gogoTime this.gogoTime = circle.gogoTime
this.gogoTimeStarted = circle.ms this.gogoTimeStarted = circle.ms
if(this.gogoTime){ if(this.gogoTime){
this.assets.fireworks.forEach(fireworksAsset => { this.assets.fireworks.forEach(fireworksAsset => {
fireworksAsset.setAnimation("normal") fireworksAsset.setAnimation("normal")
@ -726,24 +727,18 @@ class View{
this.assets.fire.setAnimation("normal") this.assets.fire.setAnimation("normal")
var don = this.assets.don var don = this.assets.don
don.setAnimation("gogostart") don.setAnimation("gogostart")
don.setAnimationStart(circle.ms) var length = don.getAnimationLength("gogo")
don.setUpdateSpeed(this.beatInterval / (length / 4))
var start = circle.ms - (circle.ms % this.beatInterval)
don.setAnimationStart(start)
var length = don.getAnimationLength("gogostart") var length = don.getAnimationLength("gogostart")
don.setAnimationEnd(circle.ms + length * don.speed, () => { don.setAnimationEnd(start + length * don.speed, don.normalAnimation)
don.setAnimationStart(0)
if(this.gogoTime){
don.setAnimation("gogo")
}else{
don.setAnimation("normal")
}
})
} }
} }
drawGogoTime(){ drawGogoTime(){
var ms = this.controller.getElapsedTime().ms var ms = this.controller.getElapsedTime().ms
if(this.gogoTime){
if(this.gogoTimeStarted){
} if(this.gogoTime){
var circles = this.controller.parsedSongData.circles var circles = this.controller.parsedSongData.circles
var lastCircle = circles[circles.length - 1] var lastCircle = circles[circles.length - 1]
var endTime = lastCircle.getEndTime() + 3000 var endTime = lastCircle.getEndTime() + 3000
@ -755,7 +750,7 @@ class View{
} }
}else{ }else{
if(this.assets.don.getAnimation() === "gogo"){ if(this.assets.don.getAnimation() === "gogo"){
this.assets.don.setAnimation("normal") this.assets.don.normalAnimation()
} }
if(ms >= this.gogoTimeStarted + 100){ if(ms >= this.gogoTimeStarted + 100){
this.assets.fire.setAnimation(false) this.assets.fire.setAnimation(false)
@ -776,14 +771,7 @@ class View{
var ms = this.controller.getElapsedTime().ms var ms = this.controller.getElapsedTime().ms
don.setAnimationStart(ms) don.setAnimationStart(ms)
var length = don.getAnimationLength("10combo") var length = don.getAnimationLength("10combo")
don.setAnimationEnd(ms + length * don.speed, () => { don.setAnimationEnd(ms + length * don.speed, don.normalAnimation)
don.setAnimationStart(0)
if(this.gogoTime){
don.setAnimation("gogo")
}else{
don.setAnimation("normal")
}
})
} }
} }
onmousemove(event){ onmousemove(event){

View File

@ -30,10 +30,25 @@ class ViewAssets{
11,11,11,11,10,9 ,8 ,7 ,13,12,12,13,14,15,16,17 11,11,11,11,10,9 ,8 ,7 ,13,12,12,13,14,15,16,17
], "don_anim_normal") ], "don_anim_normal")
this.don.addFrames("10combo", 22, "don_anim_10combo") this.don.addFrames("10combo", 22, "don_anim_10combo")
this.don.addFrames("gogo", 56, "don_anim_gogo") this.don.addFrames("gogo", [
42,43,43,44,45,46,47,48,49,50,51,52,53,54,
55,0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,11,12,13,
14,14,15,16,17,18,19,20,21,22,23,24,25,26,
27,28,29,30,31,32,33,34,35,36,37,38,39,40,41
], "don_anim_gogo")
this.don.addFrames("gogostart", 27, "don_anim_gogostart") this.don.addFrames("gogostart", 27, "don_anim_gogostart")
this.don.setAnimation("normal") this.don.normalAnimation = () => {
this.don.setUpdateSpeed(this.beatInterval / 16) if(this.view.gogoTime){
var length = this.don.getAnimationLength("gogo")
this.don.setUpdateSpeed(this.beatInterval / (length / 4))
this.don.setAnimation("gogo")
}else{
this.don.setAnimationStart(0)
this.don.setUpdateSpeed(this.beatInterval / 16)
this.don.setAnimation("normal")
}
}
this.don.normalAnimation()
this.fire = this.createAsset("bar", frame => { this.fire = this.createAsset("bar", frame => {
var imgw = 360 var imgw = 360
var imgh = 370 var imgh = 370
@ -92,7 +107,7 @@ class ViewAssets{
return asset return asset
} }
drawAssets(layer){ drawAssets(layer){
if(this.controller.multiplayer !== 2){ if(this.controller.multiplayer !== 2 || layer === "bar"){
this.allAssets.forEach(asset => { this.allAssets.forEach(asset => {
if(layer === asset.layer){ if(layer === asset.layer){
asset.draw() asset.draw()