Documentation menuDocumentation
Lagrangian documentation
Animation with real physics: springs that keep their momentum when interrupted, throws with friction onto snap points, and a small 2D world with gravity, collisions, joints and rolling. About 12 kB.
Try the live demoStart
- Why LagrangianAnimation with real physics: interruptible springs, throws with friction, gravity and collisions.
- Getting startedInstall Lagrangian and spring, drag and drop your first element.
- Migrating to 2.0What changes between Lagrangian 1.x and 2.0, and how to keep the old behaviour while you update.
Guides
- SpringsConfigure springs by feel or by physics, read velocity, and use the maths directly.
- Drag and throwDraggable elements with velocity, friction, bounds, rubber-banding and snap points.
- The worldGravity, collisions, friction, rolling, springs, joints, sensors and grabbing for round, rectangular and polygonal bodies.
- Scrolling with physicsInertia, rubber-banding and snap points for a scroll area, with wheel, keyboard and scrollTo on the same values.
- Equations of motionStep your own physics with RK4, e.g. a double pendulum from its Lagrangian.
- ReactHooks for springs, dragging and the world, without re-rendering on every frame.
- VueComposables for springs, dragging, scrolling and the world in Vue 3.
- SvelteActions and stores for springs, dragging, scrolling and the world in Svelte.
- Reduced motionWhat happens when users ask their system for less motion.
Pro
- Lagrangian ProReady-made physical UI on top of Lagrangian, with prices, installation and what each piece does.
- Bottom sheetA sheet with detents that lands where the throw would carry it.
- Swipe stackCards to swipe away that tilt around the grip point and fly off at the thrown speed.
- Sortable lists and layout transitionsDrag to reorder with springs, keyboard support, and spring transitions for any DOM change.
- Pull to refresh, carousel, drawer, dialogFour more ready-made blocks with throw physics, focus handling and keyboard support.
- Toasts, indicator, fallA swipeable toast stack, a sliding tab indicator and a page effect that lets a section fall apart and come back.
- Board and zoomDrag to rearrange a grid or the columns of a board, and pinch, wheel and double tap zoom for images and maps.
- PopoverA popover anchored to its trigger that springs out of the facing side, flips when there is no room and follows the page while it scrolls.
- Stack navigationPages that slide over each other, swipe back from the left edge and share elements, with focus and screen reader handling.
- GesturesHow a carousel in a drawer, a sheet around a carousel and a swipe back decide who gets the finger.
- Jelly, ropes and impact soundsSquash and stretch from velocity, Verlet ropes you can grab, and synthesized impact sounds.
- recipes
- Ready-made recipesThree finished patterns as one function each, a form in a bottom sheet, a photo gallery and swipeable list rows, with the pitfalls already handled.
- spring editor
- AccessibilityWhat Lagrangian Pro does for keyboard and screen reader users, for reduced motion and for touch, part by part.
- Migrating to 1.0What changes between Lagrangian Pro 0.x and 1.0, and the versioning promise from 1.0 on.