Skip to content
animorio
IT
Back to the library

Light cube on water

WebGL, 3DGSAP, WebGL, CanvasAdvancedCompressed weight: Demo 8.7 KBGSAP + CustomEase 31 KBThree.js 174 KBFreeDownload the zip

A WebGL hero for a made-up real estate developer: at night, over dark still water, a cube made of blue light turns slowly on itself and floats. It has thin white edges, a fine grid on its faces and rims that light up from the side; every ten seconds a wave leaves its centre and crosses the faces, drawing a white hexagon pattern. The water mirrors it with ripples, and two hills catch its light.

Rebuilt from scratch studying hubtown.co.in by Unseen Studio: the idea is theirs; code, copy and images are ours. Read how it’s made

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Light cube on water" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>VEYRA</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/hanken-grotesk@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
  <script type="importmap">
    { "imports": {
      "three": "https://cdn.jsdelivr.net/npm/three@0.178.0/build/three.module.min.js",
      "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.178.0/examples/jsm/"
    } }
  </script>
</head>
<body>
  <!-- a made-up real estate developer, VEYRA. A cube of blue light floats over dark water at night, turning slowly,
       with a hexagon wave crossing its faces every few seconds; the water mirrors it and two hills catch its light -->
  <main class="palco" data-palco>
    <canvas class="tela" data-tela role="img" aria-label="A glowing blue cube floating over dark water at night"></canvas>

    <!-- if WebGL is missing: a flat glowing square over a line of water -->
    <div class="ripiego" data-ripiego aria-hidden="true"><span class="ripiego-cubo"></span></div>

    <header class="testa">
      <span class="marchio" data-marchio>VEYRA</span>
      <span class="sezione">Future</span>
    </header>

    <div class="racconto" data-racconto>
      <h1 class="titolo" data-titolo>We build what<br>comes next</h1>
      <p class="riga" data-riga>Homes, offices and whole districts, designed for the decades ahead and built to last.</p>
    </div>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/CustomEase.min.js"></script>
  <script type="module" src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

16 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Light cube on water” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

At night, in a blue sky fading towards the horizon with a few stars gently twinkling, a cube made of blue light floats over dark water. It turns on itself by a tenth of a radian per second and rises and falls a little, always with the same breath; a slow noise moves over its faces from deep blue to light blue, there is a fine grid, a few panels light up and go out, the edges are thin white lines and the sides that turn away light up at the rim. Every ten seconds a wave leaves the centre of the cube and crosses the faces: where it passes it draws a pattern of white hexagons, which stays faintly lit behind it and then fades. Below, the water mirrors the cube, the sky and the hills with long and fine ripples, and under the cube a streak of light trembles towards the viewer; two dark hills at the sides catch the blue glow on the slopes facing the cube, and a few grains of light rise slowly over the water. On opening the camera arrives from far away, then the letters of the headline light up in random order. The pointer, or a finger, tilts the camera slightly.

How it works

A cube painted in the shader

The cube is a BoxGeometry with a hand-written ShaderMaterial: from the coordinates of the point on the cube the shader works out which face it is on, and draws everything there. The colour is a fractal noise (fbm) slowly moving between deep blue and light blue, the grid is made with fract and fwidth (lines always one pixel wide, at any distance), the edges are where one of the two face coordinates reaches the border.

Fresnel, as on the original

The rim of the sides turning away lights up with fresnel: pow(1 − dot(normal, view), 3.5) × 3.1, and the colour is multiplied by max(1, 3.6 × fresnel). These are the numbers from the site’s shader: they make the cube look made of light and not of plastic, without any bloom.

The hexagon wave

Every WAVE_EVERY seconds a band leaves the centre of the cube (the distance of the point from the centre) and spreads to the corners in half the cycle, then rests: the same rhythm as the site, which keeps it on half the time. Where the band passes, a hexagon grid computed in the shader turns white; just behind it a thread of light remains.

The mirroring water

The water is a Three.js Reflector with our own shader: the reflection coordinates are shifted by three noises at different scales (long swell, ripple, shiver), the light drops with distance, and under the cube a streak stretched towards the camera trembles where the fine noise is highest. The cube, the halo, the hills and the specks are mirrored by themselves.

The hills and the camera

The hills are two planes bent in JavaScript (a profile rising outwards plus a few crests), lit in the shader only by the cube’s position: the closer and the more they face the cube, the bluer. The camera stands at the distance needed for the cube and its reflection to fit in the window, recomputed on every resize; on opening it arrives from 30 units further away with the site’s joe.out curve.

Values to change

NameFileDefaultWhat it changes
ROTATION_SPEEDscript.js0.1How fast the cube turns on itself (radians per second, as on the original).
FLOATscript.js1How much the cube floats up and down (1 = as on the original).
WAVE_EVERYscript.js10How many seconds between two hexagon waves.
GLOWscript.js1How strongly the cube lights the water and the hills.
RIPPLESscript.js1How much the water ripples the reflection.
SPECKSscript.js220How many specks of light rise over the water.

Try them in the Playground

When to use it

For the hero of a real estate developer, an architecture studio, a building project or a technology company that wants a single image, still and solemn: the cube is the ‘brick’ of the future, and the still water gives the page calm.

On phones

The same scene with adapted sizes: the camera pulls back as far as needed for the cube and its reflection to fit in the box above the words, and a touch tilts the camera like the pointer.

With reduced motion

The cube stays still, without turning, floating or hexagon wave, and the camera does not fly in: the light, the reflection and the hills are already in place, and the headline fades in.

Pitfalls

  • The Reflector clones the uniforms of the shader you pass: to update them every frame they must be taken from acqua.material.uniforms, not from the object written in the constructor.
  • The grid and the hexagons use fwidth: without it, far away or edge on they turn into moiré.
  • The halo is a plane that always faces the camera and adds up (AdditiveBlending) without writing to the depth buffer: this way it is mirrored in the water too and does not cut the cube.
  • In the reflection the ripple offset must be multiplied by uv.w, because texture2DProj coordinates are projective.

Libraries

Three.js 0.178.0, GSAP 3.15.0, Hanken Grotesk (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.7 KB; the libraries: GSAP + CustomEase 31 KB, Three.js 174 KB.

Testing

Tested on 25 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations