lab

ProximityEffect - Demo 9: 'Dandelion'

Brush the pointer through the clock to blow its seeds away, or press Blow. They catch the wind of your movement: sweep sideways and they sail that way, out of the frame and across the page. Leave them be and the clock slowly mends itself.

How it works

  • The seeds sit on the front half of a ball, seen from the front, so the ones in the middle point at you and have short stalks.
  • Five ProximityEffect instances follow the pointer: three for the seeds, one for the grass and one for the flower's lean.
  • Nothing pushes the seeds outwards. translateZ brings them towards you, and the head's perspective spreads them out from its centre as they come.
  • The seeds come in three bands, each its own instance, by how close to you they fly. The nearest band is the most blurred, like a camera's depth of field. With one instance, scatter would roll the depth and the blur separately, and a seed could fly right up to you and stay sharp.
  • The wind is the pointer's speed. Every frame, updateStyle() gives the seeds' translateX and translateY, and the grass's and flower's rotate, a new near value. Each seed keeps its own scatter, so the ones in the air swing with the wind.
  • ProximityEffect maps distance to style; nothing here is simulated. A seed stays up while the pointer is near the place it left, and a slow decay brings it home, so the clock appears to grow back.
code