Skip to content

MesmerPrism/Physics-Notebook

 
 

Repository files navigation

Physics Notebook 🔬

An interactive collection of physics concepts with beautiful visualizations and real-time simulations


📖 About

Physics Notebook is an open-source interactive learning platform that brings physics concepts to life through beautiful visualizations and real-time simulations. Each concept features:

  • 🎨 Interactive Canvas Animations - Real-time visualizations built with HTML5 Canvas
  • 🧮 Mathematical Equations - Rendered beautifully using MathJax
  • 🤖 AI Integration - Quick access to AI assistants (Perplexity, Gemini, ChatGPT, Claude, Grok)
  • 🎛️ Adjustable Parameters - Sliders and controls to explore different scenarios
  • 🌓 Dark/Light Mode - Seamless theme switching
  • 📱 Responsive Design - Works beautifully on all devices

✨ Features

Current Concepts

Mechanics

  • 🌀 Harmonic Oscillation
  • 🏹 Projectile Motion
  • 🪐 Orbital Mechanics
  • ⏱️ Simple Pendulum

Waves & Optics

  • 🌊 Wave Interference
  • 🔍 Double Slit Experiment

Electromagnetism

  • ⚡ Electric Fields

Technical Highlights

  • Zero Dependencies - Pure vanilla JavaScript (except MathJax)
  • Performance Optimized - IntersectionObserver for canvas rendering
  • HiDPI/Retina Support - Crystal clear on all displays
  • GSAP Animations - Smooth scroll-triggered animations
  • Modular Architecture - Easy to extend with new concepts

🚀 Getting Started

Prerequisites

You only need a modern web browser! No build process or dependencies required.

Installation

  1. Clone the repository
git clone https://github.com/CasberryIndia/Physics-Notebook.git
cd Physics-Notebook
  1. Open index.html in your browser
# Using Python's built-in server
python -m http.server 8000

# Or using Node's http-server
npx http-server
  1. Navigate to http://localhost:8000

That's it! 🎉

📂 Project Structure

Physics-Notebook/
├── index.html              # Main library page
├── CONCEPT_PATTERN.md      # Guide for creating new concepts
├── Concepts/               # Individual concept pages
│   ├── simple-pendulum.html
│   ├── double-slit-experiment.html
│   ├── orbital-mechanics.html
│   └── ...
├── css/
│   ├── common.css          # Shared styles
│   ├── home.css            # Library page styles
│   └── article.css         # Concept page styles
└── js/
    └── common.js           # Theme toggle & utilities

🤝 Contributing

We love contributions! Whether it's a new physics concept, bug fix, or improvement, your help is welcome.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-concept)
  3. Make your changes
  4. Test thoroughly - Open your concept in a browser
  5. Commit your changes (git commit -m 'Add amazing new concept')
  6. Push to the branch (git push origin feature/amazing-concept)
  7. Open a Pull Request

Creating a New Concept

Follow our comprehensive CONCEPT_PATTERN.md guide. Here's the quick version:

1. Create Your Concept File

Create a new HTML file in the Concepts/ directory:

touch Concepts/your-concept-name.html

2. Follow the Standard Structure

Every concept should have:

  • HTML Structure

    • <head> with proper metadata, fonts, MathJax, GSAP, Lucide icons
    • Navigation bar with back button and theme toggle
    • Hero section with concept title and description
    • 3 sections with split-layout (content + visualization)
    • References section
  • Section Components (repeat for 3 sections)

    • Section label (01, 02, 03)
    • Content column with:
      • Title and description
      • Mathematical equations in <div class="math-block">
      • Concept cards (<div class="etu-card">)
      • AI assistance links (all 5 providers)
      • Interactive controls (<div class="sim-controls">)
    • Visualization column with <canvas> element
  • JavaScript Architecture

    • openAI() function for AI integrations
    • APP object managing initialization
    • BaseVisual class for canvas rendering
    • Specific visual classes extending BaseVisual
    • IntersectionObserver for performance
    • GSAP scroll animations

3. Example: Basic Visual Class

class MyConceptVisual extends BaseVisual {
    constructor(id) {
        super(id);
        this.time = 0;
        this.setupControls();
    }

    setupControls() {
        const slider = document.getElementById('my-slider');
        slider.addEventListener('input', (e) => {
            this.parameter = parseFloat(e.target.value);
        });
    }

    draw() {
        this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
        this.time += 0.03;
        
        // Your visualization logic here
        // Use this.color, this.accent, this.scale, etc.
        // from BaseVisual
    }
}

4. Add to Main Index

Update index.html DATA array:

{
    id: 'your-concept',
    title: 'Your Concept Title',
    domain: 'Mechanics', // or 'Waves', 'Electromagnetism', 'Quantum'
    desc: 'Brief description for the card.',
    type: 'your-type',
    href: 'Concepts/your-concept-name.html'
}

5. Test Your Concept

  • ✅ Works in both light and dark themes
  • ✅ All sliders update visual in real-time
  • ✅ All AI links open correctly
  • ✅ Equations render properly (wait for MathJax)
  • ✅ Responsive on mobile devices
  • ✅ Canvas animations are smooth (60fps)

Contribution Guidelines

  • Code Style: Follow existing patterns for consistency
  • Performance: Use IntersectionObserver for canvas rendering
  • Accessibility: Ensure proper semantic HTML
  • Physics Accuracy: Double-check equations and concepts
  • Documentation: Comment complex visualization logic
  • Testing: Test on Chrome, Firefox, and Safari

📚 Resources

🎨 Design Philosophy

Visual Excellence

We prioritize stunning visuals over minimal viable products. Every concept should:

  • Use vibrant, harmonious color palettes
  • Include smooth, engaging animations
  • Provide immediate visual feedback
  • Feel premium and polished

Educational Value

Each concept must:

  • Start simple, build complexity
  • Include real-world analogies
  • Provide interactive exploration
  • Link to academic references

Performance First

  • Lazy load canvas rendering (IntersectionObserver)
  • HiDPI scaling for sharp visuals
  • Smooth 60fps animations
  • Minimal dependencies

📊 GitHub Star History

Star History Chart

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Physics concepts inspired by classic textbooks (Halliday, Resnick, Walker)
  • Animations powered by GSAP
  • Icons by Lucide
  • Mathematics rendered by MathJax

💬 Community

🚧 Roadmap

  • More Mechanics concepts (Friction, Collisions)
  • Thermodynamics section
  • Special Relativity visualizations
  • 3D visualizations using Three.js
  • Mobile app (React Native)
  • Offline PWA support
  • Multi-language support

Made with ❤️ by the Physics Notebook Community

⬆ Back to Top

About

An interactive collection of physics concepts with beautiful visualizations and real-time simulations

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 97.4%
  • CSS 2.1%
  • JavaScript 0.5%