Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ahmedghazi/9bcc806bac262cf6341ed8fc6c45e8b2 to your computer and use it in GitHub Desktop.
Save ahmedghazi/9bcc806bac262cf6341ed8fc6c45e8b2 to your computer and use it in GitHub Desktop.
Screensaver anime
this.update = function() {
if (this.x + this.radius > ww || this.x - this.radius < 0) {
this.dx = -this.dx;
}
if (this.y + this.radius > wh || this.y - this.radius < 0) {
this.dy = -this.dy;
}
this.x += this.dx;
this.y += this.dy;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment