flutter_physics_animation library

A Flutter package providing physics-based animations with realistic bouncing, gravity, and collision detection.

This package offers a comprehensive physics animation system that includes:

  • Realistic physics calculations with gravity, friction, and air resistance
  • Collision detection and resolution between objects
  • Bouncing animations with customizable elasticity
  • Spring physics for elastic animations
  • Seamless integration with Flutter's widget system
  • High performance optimized for smooth 60 FPS animations
  • Cross-platform support for iOS, Android, Web, and Desktop

Getting Started

import 'package:flutter_physics_animation/flutter_physics_animation.dart';

// Create a physics world
final world = PhysicsWorld(gravity: 9.81);

// Add physics objects
final ball = PhysicsObject(x: 100, y: 50, mass: 1.0);
world.addObject(ball);

// Create animations
final controller = PhysicsAnimationController(world: world);
controller.addBouncingAnimation(object: ball, bounceHeight: 100.0);

Classes

ArrowPhysics
Helper class for creating and managing arrow physics objects. Arrows automatically align with their velocity direction due to aerodynamic stability.
BouncingAnimation
Animation that creates realistic bouncing effects.
CollisionDetector
Handles collision detection and resolution between physics objects.
GravityAnimation
Animation that simulates gravitational effects.
HitboxAdapter
Adapter class to bridge PhysicsObject with flutter_hitbox.
PhysicsAnimatedContainer
A widget that displays multiple physics objects in a container.
PhysicsAnimatedWidget
A widget that displays a physics object with real-time animation.
PhysicsAnimationController
Controller for managing physics animations in Flutter.
PhysicsConstants
Constants used throughout the physics animation system.
PhysicsContainer
A simple container widget for physics animations.
PhysicsObject
Represents a physics object with position, velocity, and physical properties.
PhysicsUtils
Utility functions for physics calculations.
PhysicsWorld
Manages a world of physics objects and their interactions.
SpringAnimation
Animation that creates elastic spring effects.

Enums

ShapeType
Enum representing different physical shapes for physics calculations.