Skip to content

Conversation

@ShreyDudie
Copy link

Dancing Sine Wave Animation

This project is a Python-based animation that visualizes a sine wave using moving dots with a subtle "dancing" effect. Each dot follows the sine wave while slightly shifting up and down randomly, creating a lively and dynamic wave pattern.

Features

  • Smooth sine wave animation with pygame.
  • Dots move along a sine wave path.
  • Random vertical "dance" for a natural, dynamic effect.
  • Adjustable parameters for amplitude, frequency, speed, number of dots, and colors.

How It Works

  1. Dots are evenly spaced horizontally across the screen.
  2. Each dot's vertical position is calculated using a sine function.
  3. A small random offset is added to the vertical position for the dancing effect.
  4. The wave continuously moves horizontally using a wave offset value.

Customization

closes #1679

You can modify these parameters in the code:

  • AMPLITUDE – controls the height of the wave.
  • FREQUENCY – determines how many wave cycles fit on the screen.
  • SPEED – controls how fast the wave moves horizontally.
  • NUM_DOTS – number of dots along the wave.
  • DOT_RADIUS – size of each dot.
  • BG_COLOR – background color.
  • DOT_COLOR – color of the dots.

Requirements

  • Python 3.6+
  • pygame library (pip install pygame)

Running the Program

  1. Save the script as dancing_sine_wave.py.
  2. Run it using:
python dancing_sine_wave.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sine Wave Dancer

1 participant