Skip to content

Commit

Permalink
🐛 Bouncing Logo > Fix stuck on edge
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosimon committed Sep 3, 2021
1 parent a563b56 commit 40b5631
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Experience/BouncingLogo.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,24 @@ export default class BouncingLogo
this.animations.z += this.animations.speed.z * this.time.delta
this.animations.y += this.animations.speed.y * this.time.delta

if(this.animations.z > this.animations.limits.z.max || this.animations.z < this.animations.limits.z.min)
if(this.animations.z > this.animations.limits.z.max)
{
this.animations.z = this.animations.limits.z.max
this.animations.speed.z *= -1
}
if(this.animations.y > this.animations.limits.y.max || this.animations.y < this.animations.limits.y.min)
if(this.animations.z < this.animations.limits.z.min)
{
this.animations.z = this.animations.limits.z.min
this.animations.speed.z *= -1
}
if(this.animations.y > this.animations.limits.y.max)
{
this.animations.y = this.animations.limits.y.max
this.animations.speed.y *= -1
}
if(this.animations.y < this.animations.limits.y.min)
{
this.animations.y = this.animations.limits.y.min
this.animations.speed.y *= -1
}

Expand Down

0 comments on commit 40b5631

Please sign in to comment.