diff --git a/docker-compose/requirements/djangoserver/file/server/server/Game.py b/docker-compose/requirements/djangoserver/file/server/server/Game.py index 2fbc4cf..78f2c57 100644 --- a/docker-compose/requirements/djangoserver/file/server/server/Game.py +++ b/docker-compose/requirements/djangoserver/file/server/server/Game.py @@ -6,7 +6,7 @@ # By: edbernar start + (end - start) * t; + const thisClass = this; + const speedFactor = 0.5; + + if (thisClass.animationFrame) + cancelAnimationFrame(thisClass.animationFrame); + const animate = () => { + this.object.position.x = lerp(this.object.position.x, content.pos, speedFactor); + if (Math.abs(this.object.position.x - content.pos) < 0.01) + this.object.position.x = content.pos; + else + thisClass.animationFrame = requestAnimationFrame(animate); + }; + + thisClass.animationFrame = requestAnimationFrame(animate); + if (content.up && thisClass.object.position.y < thisClass.limits.up) { if (this.interval)