May 12, 2024 - David Oyinbo
Canvas Gravity Balls
Pet project for HTML Canvas and JavaScript—simulating gravity, bounce, and simple collisions across multiple balls.
JavaScriptHTML CanvasPhysicsAnimationPet Project

Overview
This experiment uses Canvas 2D APIs to render and animate circles influenced by gravity with basic collision and bounce behavior. It focuses on animation loops, simple physics, and interaction.
Highlights
Physics
- Gravity and velocity integration
- Bounce with restitution (elasticity)
- Basic wall collision handling
Canvas Rendering
- Efficient clear + redraw loop
- Responsive canvas sizing
- Minimal draw calls
Interaction
- Mouse clicks to spawn balls
- Adjustable gravity/restitution (in code)
- Smooth motion via requestAnimationFrame
Footprint
- No dependencies
- Small, hackable codebase
- Great for learning Canvas + physics basics
Gallery



Other Projects

Payaza Web SDK
A JavaScript Web SDK that simplifies integrating Payaza checkout on web applications. Built as part of my role at Payaza Africa.
SDKJavaScriptPayments

Auth module for Nuxt server apps
Auth module for Nuxt 3 server apps with local and social providers, tokens, middlewares, and typed composables.
TypeScriptNuxt 3Auth

Canvas Random Floating Circle
Pet project animating randomly floating circles on HTML Canvas with simple drift and easing.
JavaScriptHTML CanvasAnimation