src/js/lib/letterAnimation.js
/**
   * Take a step of animation (frame).
   * @returns true if the letter's animation is done, false otherwise
   */
Take a step of animation (frame).
@returns true if the letter's animation is done, false otherwise
Take a step of animation ( frame ) . @returns true if the letter ' s animation is done false otherwise
step() {
		if (this.letter.isOffscreen()) {
			return false;
		}
		this.letter.x += this.dx;
		this.letter.y += this.dy;
		if (this.letter.y + LETTER_HEIGHT >= HEIGHT) {
			this.dy *= -DAMPENING;
			this.letter.y = HEIGHT - LETTER_HEIGHT;
		} else {
			this.dy += GRAVITY / SECS_PER_FRAME;
		}
		this.letter.draw();
		return true;
	}
step ( ) { if ( this . letter . isOffscreen ( ) ) { return false ; } this . letter . x += this . dx ; this . letter . y += this . dy ; if ( this . letter . y + LETTER_HEIGHT >= HEIGHT ) { this . dy *= - DAMPENING ; this . letter . y = HEIGHT - LETTER_HEIGHT ; } else { this . dy += GRAVITY / SECS_PER_FRAME ; } this . letter . draw ( ) ; return true ; }
Take a step of animation (frame).
Take a step of animation ( frame ) .
// Return false to indicate that the letter should no longer be animated // Update letter position with velocity // If we've hit (or passed) the floor, bounce // Prevent letter from getting stuck below the floor (which very // quickly dampens dy to 0) // Otherwise, apply gravity // The letter moved in this frame, so we may have more to animate