Skip to content

laneyweb/reaction-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Reaction Timer Game

A simple web-based reaction timer game built with HTML, CSS, and JavaScript.

Features

  • Start button to begin a round
  • Random delay before the signal appears
  • Visual cue (green background) when it's time to click
  • Reaction time displayed in milliseconds
  • History of the last 10 attempts with color coding:
    • Green: faster than the previous attempt
    • Red: slower than the previous attempt
    • Default: most recent attempt (until compared)

How to Play

  1. Click the "Start" button
  2. Wait for the screen to turn green and display "CLICK!"
  3. Click as quickly as possible when you see the signal
  4. Your reaction time (in ms) will be displayed
  5. Continue playing to build your history

Implementation Details

  • Uses performance.now() for high-resolution timing
  • Listens for mousedown events for slightly better responsiveness than click
  • Stores reaction times in an array, keeping only the last 10 attempts
  • Color coding compares each attempt with the next most recent one

Customization

Adjust the following variables in the JavaScript to change game behavior:

  • Delay range: currently 2000-5000ms (2-5 seconds)
  • History length: currently 10 attempts
  • Colors: modify the CSS variables for different themes

Technologies

  • HTML5
  • CSS3 (with flexbox layout)
  • Vanilla JavaScript (no frameworks)

License

This project is open source and available for modification and distribution.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages