Physics Drag

Mood track «Pamgaea» · Kevin MacLeod incompetech.com · licensed under Creative Commons BY 4.0
Example image of the style Physics Drag
Preview built in HTML and CSS in this style

Trascinamento con fisica · Arrastre con física · Inertia drag · Throwable UI · Elementi lanciabili

Page elements you can grab, fling and bounce like real objects, with weight, inertia and gravity. The interface becomes a small toy to play with.

Era
2014 – today
Use
Mainstream
Domain
Web / UIMotion
Mood
playfultactileenergetic
Explore

Live demo

View code
<h1>Afferra e lancia</h1>
<div class="b" style="--c:#FF5E3A;--s:96px">trascina</div>
<div class="b" style="--c:#2EC4B6;--s:80px">lancia</div>
<div class="b" style="--c:#FFBF1F;--s:70px">salta</div>
<div class="b" style="--c:#6C63FF;--s:58px">wow</div>
<script>
const rm=!matchMedia('(prefers-reduced-motion: no-preference)').matches,E=[...document.querySelectorAll('.b')];
const S=E.map((el,i)=>({el,r:el.offsetWidth/2,x:60+i*80,y:70+i*20,vx:rm?0:7-i*4,vy:rm?0:-3,d:0}));
let cur=null,lx=0,ly=0;
E.forEach((el,i)=>el.onpointerdown=e=>{cur=S[i];cur.d=1;lx=e.clientX;ly=e.clientY;el.setPointerCapture(e.pointerId)});
addEventListener('pointermove',e=>{if(!cur)return;cur.vx=e.clientX-lx;cur.vy=e.clientY-ly;cur.x+=cur.vx;cur.y+=cur.vy;lx=e.clientX;ly=e.clientY});
addEventListener('pointerup',()=>{if(cur){cur.d=0;if(rm)cur.vx=cur.vy=0}cur=null});
(function f(){const W=innerWidth,H=innerHeight;S.forEach(o=>{if(!o.d&&!rm){o.vy+=.45;o.vx*=.995;o.x+=o.vx;o.y+=o.vy;
  if(o.x<o.r){o.x=o.r;o.vx*=-.8}if(o.x>W-o.r){o.x=W-o.r;o.vx*=-.8}if(o.y<o.r){o.y=o.r;o.vy*=-.8}if(o.y>H-o.r){o.y=H-o.r;o.vy*=-.72;o.vx*=.97}}
  o.el.style.transform=`translate(${o.x-o.r}px,${o.y-o.r}px) rotate(${o.x/o.r*40}deg)`});requestAnimationFrame(f)})();
</script>
body{margin:0;height:100vh;overflow:hidden;background:#F6F1E7;font-family:Rubik,sans-serif;color:#1E1B18;touch-action:none;user-select:none}
h1{position:absolute;left:0;right:0;top:38%;margin:0;text-align:center;font-weight:800;font-size:clamp(32px,8vw,56px);letter-spacing:-.03em;color:#1E1B1822}
.b{position:absolute;left:0;top:0;width:var(--s);height:var(--s);border-radius:50%;background:var(--c);border:3px solid #1E1B18;box-shadow:inset -6px -8px 0 #0002;display:grid;place-items:center;font-weight:500;font-size:13px;cursor:grab}
.b:active{cursor:grabbing}

Characteristics

  • Throw velocity derived from the gesture
  • Inertia and friction slowing things down
  • Elastic bounces off the edges
  • Springs pulling items back into place
  • Simple shapes and solid toy-like colours

Palette

Click a swatch to copy it

Typography

Headings · Rubik Physics Drag

Body · Rubik Page elements you can grab, fling and bounce like real objects, with weight, inertia and gravity. The interface becomes a small toy to play with.

Motion

Easing
fisica (molle e attrito) invece di curve fisse
Typical duration
guidata dal gesto; assestamento 0.5–2 s
Techniques
Pointer Events con setPointerCapture, requestAnimationFrame, Matter.js, GSAP Draggable + InertiaPlugin, Framer Motion drag, spring physics

Accessibility (reduced motion)

Keep dragging but drop the fling and bounces; items stay where they are released.

Prompt for your agent

Copy and paste into your prompt to have an agent or image generator reproduce this style.

For web pages and UI

Design the web page or interface in this style: Physics Drag (Trascinamento con fisica, Arrastre con física).
Page elements you can grab, fling and bounce like real objects, with weight, inertia and gravity. The interface becomes a small toy to play with.
Characteristics: Throw velocity derived from the gesture, Inertia and friction slowing things down, Elastic bounces off the edges, Springs pulling items back into place, Simple shapes and solid toy-like colours.
Palette: #F6F1E7, #1E1B18, #FF5E3A, #2EC4B6, #FFBF1F, #6C63FF.
Typography: headings in Rubik, body text in Rubik (Google Fonts or equivalents).
Mood: playful, tactile, energetic.
Motion: easing fisica (molle e attrito) invece di curve fisse, typical duration guidata dal gesto; assestamento 0.5–2 s; techniques: Pointer Events con setPointerCapture, requestAnimationFrame, Matter.js, GSAP Draggable + InertiaPlugin, Framer Motion drag, spring physics.
With prefers-reduced-motion: Keep dragging but drop the fling and bounces; items stay where they are released.
References: Matter.js, GSAP Draggable + InertiaPlugin, Framer Motion drag, «Google Gravity» (2009).

Relations

Derives from: Micro-interactionsMicro-interactionsDerives from: Squash & StretchSquash & StretchInfluenced: Swipe cardsSwipe cardsSimilar to: Before/after sliderBefore/after sliderSimilar to: Custom CursorCustom CursorSimilar to: Drag to reorderDrag to reorderSimilar to: Infinite CanvasInfinite CanvasSimilar to: Tilt HoverTilt HoverSimilar to: ClaymorphismClaymorphismSimilar to: Spring PhysicsSpring PhysicsPhysics Drag
Derives fromInfluencedSimilar toSee in the graph →

References

  • Matter.js
  • GSAP Draggable + InertiaPlugin
  • Framer Motion drag
  • «Google Gravity» (2009)