Cinema Seat Flight

Codrops’ actual camera Rig: lifted cubic flights clear the seat backs, gaze stays on screen, drag and head movement layer on top, and reduced motion uses a crossfade. A minimal independent auditorium demonstrates it.

Exact preview of Cinema Seat Flight
Type
Component
Category
WebGL
Source license
MIT
Collection
Open Source Experiences

View source in the repository

Usage

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Frontfield component</title>
<style>html,body{margin:0;background:#121418;color:#eee;font:14px system-ui}canvas{display:block}button{padding:10px 16px}</style>
<!-- Serve the included public/experiences/cinema/ directory alongside this file. -->
<button id="travel" style="position:fixed;z-index:1;top:20px;left:20px">Fly to G / 11</button><div class="fade" style="position:fixed;inset:0;background:#000;opacity:0;pointer-events:none;z-index:2"></div>
<script type="importmap">{
  "imports": {
    "three": "/experiences/cinema/js/lib/three.webgpu.js",
    "three/webgpu": "/experiences/cinema/js/lib/three.webgpu.js",
    "three/tsl": "/experiences/cinema/js/lib/three.tsl.js",
    "three/addons/": "/experiences/cinema/js/lib/addons/"
  }
}</script>
<script src="/experiences/cinema/js/lib/gsap.min.js"></script>
<script type="module">
import * as THREE from 'three/webgpu';
import {Rig} from '/experiences/cinema/js/rig.js';
import {seatAt} from '/experiences/cinema/js/layout.js';
const renderer=new THREE.WebGPURenderer({antialias:true,forceWebGL:true});
await renderer.init(); renderer.setSize(innerWidth,innerHeight); document.body.append(renderer.domElement);
const scene=new THREE.Scene(); scene.background=new THREE.Color('#17141d');
const camera=new THREE.PerspectiveCamera(50,innerWidth/innerHeight,.1,100);
const screen=new THREE.Mesh(new THREE.PlaneGeometry(16,8),new THREE.MeshBasicMaterial({color:'#ddb77e'})); screen.position.set(0,5,-19);scene.add(screen);
const rig=new Rig(camera,{fade:document.querySelector('.fade')});
document.querySelector('#travel').onclick=()=>rig.flyTo(seatAt(6,11));
const clock=new THREE.Clock();
renderer.setAnimationLoop(()=>{rig.update(clock.getDelta());renderer.render(scene,camera);});
addEventListener('resize',()=>{renderer.setSize(innerWidth,innerHeight);camera.aspect=innerWidth/innerHeight;camera.updateProjectionMatrix();});
// rig.flyTo(null) returns to the overview. Add your own auditorium meshes.
</script>
</html>

License and credits

Cinema Seat Preview by Codrops. Original upstream source

Read the original MIT license

Credits and asset notices

Third-party assets and dependencies

vendor/experiences/cinema/ASSET-NOTICES.md

Keep the original source and media notices with your copy.

Explore more

  • Liquid FormExact preview of Liquid Form

    A centered silver ray-marched liquid form with authored studio reflections and pointer-responsive camera drift.

  • Boarding PassExact preview of Boarding Pass

    A live flight pass whose changed gate and times roll over like a departures board.

  • Aurora TextExact preview of Aurora Text

    Multi-colour aurora motion within a large type specimen.

Frontfield homepage