Skip to content

ProximaD/Walking-Sponge-Bob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Walking Sponge Animation

An interactive CSS and JavaScript animation of a cartoon sponge character walking across a scenic path with dynamic leg movement, eye tracking, and environmental elements.

![Walking Sponge Demo]:

Features

Character Animation

  • ๐Ÿšถ Smooth walking cycle with realistic leg and arm movement
  • ๐Ÿ‘€ Interactive eyes that follow your mouse cursor
  • ๐Ÿฆ˜ Click the character to make it jump!
  • ๐Ÿ’ƒ Body bounce effect synchronized with walking
  • ๐Ÿ‘Ÿ Dynamic foot rotation for natural stepping motion

Visual Effects

  • โ˜€๏ธ Animated sun with pulsing glow effect
  • โ˜๏ธ Floating clouds drifting across the sky
  • ๐ŸŒธ Swaying flowers in the foreground
  • ๐ŸŽจ Gradient backgrounds with depth and lighting
  • ๐ŸŒˆ Professional shadows and visual polish

Technical Highlights

  • Pure vanilla JavaScript (no frameworks)
  • CSS animations and keyframes
  • DOM-based animation using requestAnimationFrame
  • Responsive character interactions
  • Smooth mathematical animations using sine waves

๐ŸŽฎ Demo

Live Demo

๐Ÿš€ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • No build tools or dependencies required!

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/walking-sponge.git
  1. Navigate to the project directory:
cd walking-sponge
  1. Open index.html in your browser:
# On macOS
open index.html

# On Linux
xdg-open index.html

# On Windows
start index.html

That's it! No installation or build process needed.

๐Ÿ“ Project Structure

walking-sponge/
โ”‚
โ”œโ”€โ”€ index.html          # Main HTML file with character structure
โ”œโ”€โ”€ styles.css          # All styling and CSS animations
โ”œโ”€โ”€ script.js           # JavaScript animation logic
โ””โ”€โ”€ README.md           # Project documentation

๐ŸŽจ How It Works

Walking Animation

The character's walking motion is created using sine waves for smooth, natural movement:

// Leg rotation using sine waves
const leftAngle = Math.sin(step) * 35;
const rightAngle = Math.sin(step + Math.PI) * 35;

Eye Tracking

Eyes follow your mouse cursor using trigonometry:

const angle = Math.atan2(mouseY - eyeY, mouseX - eyeX);
const distance = Math.min(3, Math.hypot(mouseX - eyeX, mouseY - eyeY) / 100);

Body Bounce

Vertical bounce synchronized with steps:

const bounceY = Math.abs(Math.sin(bounce)) * 8;

๐ŸŽฏ Interactive Features

  • Mouse Movement: Move your cursor around to make the character's eyes follow you
  • Click Character: Click on the walking sponge to make it jump
  • Continuous Loop: Character walks across the screen and reappears on the left

๐Ÿ› ๏ธ Customization

Adjust Walking Speed

In script.js, modify the position increment:

position += 1.5;  // Change this value (default: 1.5)

Change Colors

In styles.css, modify the gradient values:

background: linear-gradient(135deg, #ffeb3b 0%, #ffd74a 100%);

Modify Animation Speed

Adjust the step increment in script.js:

step += 0.12;  // Change this value (default: 0.12)

๐Ÿ“š What I Learned

This project demonstrates:

  • DOM Manipulation: Controlling HTML elements with JavaScript
  • CSS Animation: Creating smooth visual effects
  • Trigonometry: Using Math.sin(), Math.cos(), Math.atan2() for realistic motion
  • Animation Timing: Using requestAnimationFrame for smooth 60fps animation
  • Event Handling: Mouse tracking and click interactions
  • Creative Coding: Combining math and code for visual expression

๐ŸŒŸ Future Enhancements

  • Add sound effects for footsteps
  • Multiple characters with different personalities
  • Day/night cycle with lighting changes
  • Mobile touch controls
  • Obstacles to jump over
  • Background parallax scrolling
  • Character customization options

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿ‘จโ€๐Ÿ’ป Author

Your Name

๐Ÿ™ Acknowledgments

  • Inspired by classic 2D character animations
  • Mathematical concepts from creative coding tutorials
  • Animation techniques from game development resources

๐Ÿ“– Resources

If you want to learn more about animation programming:


โญ If you found this project helpful, please give it a star!

๐Ÿ“ธ Screenshots

Desktop View

image

Made with โค๏ธ and lots of โ˜•

About

An interactive CSS and JavaScript animation of a cartoon sponge character walking across a scenic path with dynamic leg movement, eye tracking, and environmental elements.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors