Build the selected Inner Breeze film with Three.js and timed captions

This commit is contained in:
waozi committed 2026-10-20 15:32:22 -03:00
1 parent 4d51eb0c78
commit 0da13760d6
8 files changed
+844 -19

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
1
00:00:00,900 --> 00:00:03,600
A little space for yourself.
2
00:00:03,600 --> 00:00:08,300
New ways to move, breathe,
and find a quieter moment.
3
00:00:10,000 --> 00:00:13,300
Seven minutes of movement.
4
00:00:13,300 --> 00:00:18,400
Twelve exercises, an animated guide,
and time to rest.
5
00:00:20,000 --> 00:00:24,700
Follow twenty-four-form Tai Chi,
one movement at a time.
6
00:00:24,700 --> 00:00:29,300
Return to the parts
you want to practise.
7
00:00:31,000 --> 00:00:34,900
Let little habits earn little rewards.
8
00:00:34,900 --> 00:00:39,400
Collect coins, then spend them
on treats you choose.
9
00:00:41,000 --> 00:00:43,900
Keep a little of today.
10
00:00:43,900 --> 00:00:49,400
Write in Markdown, and keep photos
beside the moments you record.
11
00:00:51,000 --> 00:00:55,200
Lumi is here when you need
a little help.
12
00:00:55,200 --> 00:01:00,400
Change a theme, start a practice,
or find your way around.
13
00:01:01,700 --> 00:01:05,300
Inner Breeze. Make room for you.
14
00:01:05,300 --> 00:01:08,400
Begin with one small practice.
+65
View File
@@ -0,0 +1,65 @@
WEBVTT
opening-1
00:00:00.900 --> 00:00:03.600
A little space for yourself.
opening-2
00:00:03.600 --> 00:00:08.300
New ways to move, breathe,
and find a quieter moment.
workout-1
00:00:10.000 --> 00:00:13.300
Seven minutes of movement.
workout-2
00:00:13.300 --> 00:00:18.400
Twelve exercises, an animated guide,
and time to rest.
tai-chi-1
00:00:20.000 --> 00:00:24.700
Follow twenty-four-form Tai Chi,
one movement at a time.
tai-chi-2
00:00:24.700 --> 00:00:29.300
Return to the parts
you want to practise.
habits-1
00:00:31.000 --> 00:00:34.900
Let little habits earn little rewards.
habits-2
00:00:34.900 --> 00:00:39.400
Collect coins, then spend them
on treats you choose.
diary-1
00:00:41.000 --> 00:00:43.900
Keep a little of today.
diary-2
00:00:43.900 --> 00:00:49.400
Write in Markdown, and keep photos
beside the moments you record.
lumi-1
00:00:51.000 --> 00:00:55.200
Lumi is here when you need
a little help.
lumi-2
00:00:55.200 --> 00:01:00.400
Change a theme, start a practice,
or find your way around.
closing-1
00:01:01.700 --> 00:01:05.300
Inner Breeze. Make room for you.
closing-2
00:01:05.300 --> 00:01:08.400
Begin with one small practice.
+15
View File
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Inner Breeze — Make room for you</title>
<style>
html, body { margin: 0; background: #dde9e5; }
canvas { display: block; width: 100vw; height: auto; }
</style>
<script type="importmap">
{"imports":{"three":"./node_modules/three/build/three.module.js"}}
</script>
<canvas aria-label="Inner Breeze film preview with timed narration captions"></canvas>
<script type="module" src="./film.mjs"></script>
</html>
+285
View File
@@ -0,0 +1,285 @@
{
"title": "Inner Breeze — Make room for you",
"length": 69,
"fps": 24,
"renderer": "Three.js 0.169.0; orthographic layers through Social video",
"original_section_numbers": [
"01",
"03",
"05",
"06",
"08",
"09",
"10"
],
"narration_status": "Draft text only; owner approval required before OpenRouter generation",
"publication_authorized": false,
"sections": [
{
"key": "opening",
"number": "01",
"label": "Opening",
"title": [
"A little space",
"for yourself."
],
"copy": [
"New ways to move, breathe",
"and find a quieter moment."
],
"screen": "01-practice.png",
"from": 0,
"to": 9
},
{
"key": "workout",
"number": "03",
"label": "7-Minute Workout",
"title": [
"A few minutes.",
"A little movement."
],
"copy": [
"Twelve exercises, with an animated",
"guide, short rests and a countdown."
],
"screen": "03-workout.png",
"from": 9,
"to": 19
},
{
"key": "tai-chi",
"number": "05",
"label": "24-form Tai Chi",
"title": [
"One movement",
"at a time."
],
"copy": [
"Learn step by step, then return",
"to the movements you want to practise."
],
"screen": "05-tai-chi.png",
"note": "Optional unlock · outside Google Play",
"from": 19,
"to": 30
},
{
"key": "habits",
"number": "06",
"label": "Habit rewards",
"title": [
"Little habits.",
"Your own rewards."
],
"copy": [
"Earn coins as you complete habits.",
"Spend them on treats you choose."
],
"screen": "06-shop.png",
"note": "Demo habits and rewards",
"from": 30,
"to": 40
},
{
"key": "diary",
"number": "08",
"label": "Diary",
"title": [
"Keep a little",
"of today."
],
"copy": [
"Write in Markdown. Keep photos",
"alongside the moments you record."
],
"screen": "08-diary.png",
"note": "Demo diary entry",
"from": 40,
"to": 50
},
{
"key": "lumi",
"number": "09",
"label": "Lumi",
"title": [
"A little help,",
"when you need it."
],
"copy": [
"Change a theme, start a practice,",
"or find your way around with Lumi."
],
"screen": "09-lumi.png",
"note": "Demo conversation · local theme action",
"from": 50,
"to": 61
},
{
"key": "closing",
"number": "10",
"label": "Closing",
"title": [
"Inner Breeze.",
"Make room for you."
],
"copy": [
"Begin with one small practice.",
"inbe.waozi.xyz"
],
"screen": "10-apps.png",
"from": 61,
"to": 69
}
],
"captions": [
{
"key": "opening-1",
"section": "opening",
"from": 0.9,
"to": 3.6,
"lines": [
"A little space for yourself."
],
"text": "A little space for yourself."
},
{
"key": "opening-2",
"section": "opening",
"from": 3.6,
"to": 8.3,
"lines": [
"New ways to move, breathe,",
"and find a quieter moment."
],
"text": "New ways to move, breathe, and find a quieter moment."
},
{
"key": "workout-1",
"section": "workout",
"from": 10,
"to": 13.3,
"lines": [
"Seven minutes of movement."
],
"text": "Seven minutes of movement."
},
{
"key": "workout-2",
"section": "workout",
"from": 13.3,
"to": 18.4,
"lines": [
"Twelve exercises, an animated guide,",
"and time to rest."
],
"text": "Twelve exercises, an animated guide, and time to rest."
},
{
"key": "tai-chi-1",
"section": "tai-chi",
"from": 20,
"to": 24.7,
"lines": [
"Follow twenty-four-form Tai Chi,",
"one movement at a time."
],
"text": "Follow twenty-four-form Tai Chi, one movement at a time."
},
{
"key": "tai-chi-2",
"section": "tai-chi",
"from": 24.7,
"to": 29.3,
"lines": [
"Return to the parts",
"you want to practise."
],
"text": "Return to the parts you want to practise."
},
{
"key": "habits-1",
"section": "habits",
"from": 31,
"to": 34.9,
"lines": [
"Let little habits earn little rewards."
],
"text": "Let little habits earn little rewards."
},
{
"key": "habits-2",
"section": "habits",
"from": 34.9,
"to": 39.4,
"lines": [
"Collect coins, then spend them",
"on treats you choose."
],
"text": "Collect coins, then spend them on treats you choose."
},
{
"key": "diary-1",
"section": "diary",
"from": 41,
"to": 43.9,
"lines": [
"Keep a little of today."
],
"text": "Keep a little of today."
},
{
"key": "diary-2",
"section": "diary",
"from": 43.9,
"to": 49.4,
"lines": [
"Write in Markdown, and keep photos",
"beside the moments you record."
],
"text": "Write in Markdown, and keep photos beside the moments you record."
},
{
"key": "lumi-1",
"section": "lumi",
"from": 51,
"to": 55.2,
"lines": [
"Lumi is here when you need",
"a little help."
],
"text": "Lumi is here when you need a little help."
},
{
"key": "lumi-2",
"section": "lumi",
"from": 55.2,
"to": 60.4,
"lines": [
"Change a theme, start a practice,",
"or find your way around."
],
"text": "Change a theme, start a practice, or find your way around."
},
{
"key": "closing-1",
"section": "closing",
"from": 61.7,
"to": 65.3,
"lines": [
"Inner Breeze. Make room for you."
],
"text": "Inner Breeze. Make room for you."
},
{
"key": "closing-2",
"section": "closing",
"from": 65.3,
"to": 68.4,
"lines": [
"Begin with one small practice."
],
"text": "Begin with one small practice."
}
]
}
+205
View File
@@ -0,0 +1,205 @@
// The film page uses Social's shared renderer. The original ten review
// frames and screenshots stay intact; film.json selects the owner's seven.
import {
CanvasTexture, LinearFilter, Mesh, MeshBasicMaterial, NoToneMapping,
OrthographicCamera, PlaneGeometry, Scene, SRGBColorSpace, WebGLRenderer,
} from 'three';
import { params, run, size } from '/.video/runtime.js';
const WIDTH = 1920;
const HEIGHT = 1080;
const colors = {
mist: '#dde9e5', sky: '#a8c8d2', foreground: '#8fbfaf',
blue: '#3f6f8f', pine: '#1e4a40', earth: '#6e4c36',
ink: '#385a51', orange: '#f2a65e',
};
function sheet(width = WIDTH, height = HEIGHT) {
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
}
function write(context, value, x, y, pixels, color) {
context.font = `${pixels}px Inbe`;
context.fillStyle = color;
context.fillText(value, x, y);
}
function image(path) {
return new Promise((resolve, reject) => {
const picture = new Image();
picture.onload = () => resolve(picture);
picture.onerror = () => reject(new Error(`Could not load ${path}`));
picture.src = path;
});
}
function texture(canvas) {
const value = new CanvasTexture(canvas);
value.colorSpace = SRGBColorSpace;
value.minFilter = LinearFilter;
value.magFilter = LinearFilter;
value.generateMipmaps = false;
return value;
}
function plane(canvas, x, y, width, height, z) {
const material = new MeshBasicMaterial({
map: texture(canvas), transparent: true, depthTest: false,
depthWrite: false, toneMapped: false,
});
const mesh = new Mesh(new PlaneGeometry(width, height), material);
mesh.position.set(x + width / 2 - WIDTH / 2, HEIGHT / 2 - y - height / 2, z);
mesh.renderOrder = z;
return mesh;
}
function smooth(value) {
const bounded = Math.max(0, Math.min(1, value));
return bounded * bounded * (3 - 2 * bounded);
}
function background() {
const canvas = sheet();
const context = canvas.getContext('2d');
context.fillStyle = colors.mist;
context.fillRect(0, 0, WIDTH, HEIGHT);
context.fillStyle = colors.sky;
context.fillRect(1070, 0, 850, HEIGHT);
context.fillStyle = colors.foreground;
context.beginPath();
context.moveTo(1070, 620);
context.bezierCurveTo(1360, 620, 1600, 480, 1920, 510);
context.lineTo(1920, HEIGHT);
context.lineTo(1070, HEIGHT);
context.closePath();
context.fill();
return plane(canvas, 0, 0, WIDTH, HEIGHT, 0);
}
function branding(logo) {
const canvas = sheet(1000, 180);
const context = canvas.getContext('2d');
context.drawImage(logo, 118, 94, 55, 55);
write(context, 'Inner Breeze', 192, 134, 31, colors.pine);
return plane(canvas, 0, 0, 1000, 180, 2);
}
function titleLayer(section) {
const canvas = sheet(1000, 880);
const context = canvas.getContext('2d');
context.fillStyle = colors.orange;
context.fillRect(120, 218, 48, 5);
write(context, section.label, 120, 280, 27, colors.blue);
section.title.forEach((line, row) => write(context, line, 114, 423 + row * 114, 88, colors.pine));
section.copy.forEach((line, row) => write(context, line, 120, 664 + row * 57, 35, colors.ink));
if (section.note) {
write(context, section.note, 120, 820, 23, colors.earth);
}
return plane(canvas, 0, 0, 1000, 880, 3);
}
function screenLayer(picture) {
const canvas = sheet(1020, 2004);
const context = canvas.getContext('2d');
context.fillStyle = colors.pine;
context.beginPath();
context.roundRect(0, 0, 1020, 2004, 44);
context.fill();
context.drawImage(picture, 18, 18, 984, 1968);
return plane(canvas, 1219, 39, 510, 1002, 4);
}
function captionLayer(cue) {
const canvas = sheet(850, 150);
const context = canvas.getContext('2d');
context.strokeStyle = '#a9c3b9';
context.lineWidth = 1;
context.beginPath();
context.moveTo(0, 0.5);
context.lineTo(830, 0.5);
context.stroke();
cue.lines.forEach((line, row) => write(context, line, 0, 65 + row * 46, 32, colors.pine));
return plane(canvas, 120, 886, 850, 150, 5);
}
async function main() {
const canvas = document.querySelector('canvas');
const { width, height } = size();
const [film, font, logo] = await Promise.all([
fetch('./film.json').then(response => {
if (!response.ok) throw new Error('Film timeline is unavailable');
return response.json();
}),
new FontFace('Inbe', 'url(../../../assets/fonts/subset/NotoSans-App-Regular.ttf)').load(),
image('../../../assets/app/icon.png'),
]);
document.fonts.add(font);
const pictures = await Promise.all(film.sections.map(section => image(`./screens/${section.screen}`)));
const renderer = new WebGLRenderer({
canvas, alpha: false, antialias: true,
preserveDrawingBuffer: Boolean(params.get('render')),
});
renderer.setPixelRatio(1);
renderer.setSize(width, height, false);
renderer.outputColorSpace = SRGBColorSpace;
renderer.toneMapping = NoToneMapping;
renderer.setClearColor(colors.mist, 1);
const scene = new Scene();
const camera = new OrthographicCamera(-WIDTH / 2, WIDTH / 2, HEIGHT / 2, -HEIGHT / 2, 0.1, 100);
camera.position.z = 20;
scene.add(background(), branding(logo));
const sections = film.sections.map((section, index) => {
const title = titleLayer(section);
const screen = screenLayer(pictures[index]);
title.userData.restX = title.position.x;
scene.add(title, screen);
return { ...section, titleMesh: title, screenMesh: screen };
});
const captions = film.captions.map(cue => {
const mesh = captionLayer(cue);
mesh.userData.restY = mesh.position.y;
scene.add(mesh);
return { ...cue, mesh };
});
function draw(time) {
const t = Math.max(0, Math.min(film.length - 0.001, time));
for (let index = 0; index < sections.length; index += 1) {
const section = sections[index];
// Screens share one fixed position. Gentle cross-dissolves keep
// the app readable; there is no fake input or fabricated app UI.
const fadeIn = index === 0 ? smooth(t / 0.65)
: smooth((t - section.from + 0.4) / 0.8);
const fadeOut = index === sections.length - 1 ? 1
: 1 - smooth((t - section.to + 0.4) / 0.8);
const opacity = fadeIn * fadeOut;
section.screenMesh.visible = opacity > 0;
section.titleMesh.visible = opacity > 0;
section.screenMesh.material.opacity = opacity;
section.titleMesh.material.opacity = opacity;
const entrance = smooth((t - section.from + 0.15) / 1.1);
section.titleMesh.position.x = section.titleMesh.userData.restX - (1 - entrance) * 18;
}
for (const cue of captions) {
const opacity = smooth((t - cue.from) / 0.22) * (1 - smooth((t - cue.to + 0.22) / 0.22));
cue.mesh.visible = opacity > 0;
cue.mesh.material.opacity = opacity;
cue.mesh.position.y = cue.mesh.userData.restY - (1 - smooth((t - cue.from) / 0.3)) * 4;
}
renderer.render(scene, camera);
}
await run({ length: film.length, fps: film.fps, canvas, draw, gl: renderer.getContext() });
}
main().catch(async error => {
const job = params.get('render');
if (job) {
await fetch(`/render/${job}/error`, { method: 'POST', body: String(error?.stack ?? error) });
}
throw error;
});
+19
View File
@@ -0,0 +1,19 @@
{
"name": "inner-breeze-new-practices-film",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "inner-breeze-new-practices-film",
"dependencies": {
"three": "0.169.0"
}
},
"node_modules/three": {
"version": "0.169.0",
"resolved": "https://registry.npmjs.org/three/-/three-0.169.0.tgz",
"integrity": "sha512-Ed906MA3dR4TS5riErd4QBsRGPcx+HBDX2O5yYE5GqJeFQTPU+M56Va/f/Oph9X7uZo3W3o4l2ZhBZ6f6qUv0w==",
"license": "MIT"
}
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"name": "inner-breeze-new-practices-film",
"private": true,
"type": "module",
"dependencies": {
"three": "0.169.0"
}
}
+184 -19
View File
@@ -1,25 +1,190 @@
{
"id": "new-practices-review",
"title": "Inner Breeze — base frames for owner review",
"id": "inner-breeze-make-room-preview",
"title": "Inner Breeze — Make room for you",
"project": "inbe",
"status": "review-stills-only",
"length": 10,
"fps": 1,
"poster": 1,
"formats": {"landscape": [1920, 1080]},
"status": "full-caption-preview-narration-awaits-owner-approval",
"length": 69,
"fps": 24,
"poster": 12,
"formats": {
"landscape": [
1920,
1080
]
},
"output": "../../../build/videos/new-practices",
"root": "../../..",
"page": "index.html",
"page": "film.html",
"scenes": [
{"key":"opening","from":0,"to":1,"at":0,"focal":"Practice screen","focus":[0.63,0.03,0.28,0.94]},
{"key":"astral","from":1,"to":2,"at":1,"focal":"Astral Projection screen","focus":[0.63,0.03,0.28,0.94]},
{"key":"workout","from":2,"to":3,"at":2,"focal":"7-Minute Workout screen","focus":[0.63,0.03,0.28,0.94]},
{"key":"yoga","from":3,"to":4,"at":3,"focal":"Sun Salutation guide","focus":[0.63,0.03,0.28,0.94]},
{"key":"tai-chi","from":4,"to":5,"at":4,"focal":"Tai Chi guide","focus":[0.63,0.03,0.28,0.94]},
{"key":"habits","from":5,"to":6,"at":5,"focal":"Habit rewards shop","focus":[0.63,0.03,0.28,0.94]},
{"key":"radio","from":6,"to":7,"at":6,"focal":"Ambient Radio controls","focus":[0.63,0.03,0.28,0.94]},
{"key":"diary","from":7,"to":8,"at":7,"focal":"Diary entry","focus":[0.63,0.03,0.28,0.94]},
{"key":"lumi","from":8,"to":9,"at":8,"focal":"Lumi conversation","focus":[0.63,0.03,0.28,0.94]},
{"key":"closing","from":9,"to":10,"at":9,"focal":"Inner Breeze apps","focus":[0.63,0.03,0.28,0.94]}
]
{
"key": "opening",
"from": 0,
"to": 9,
"at": 4.5,
"focal": "Opening app screen",
"focus": [
0.63,
0.03,
0.28,
0.94
]
},
{
"key": "workout",
"from": 9,
"to": 19,
"at": 14.0,
"focal": "7-Minute Workout app screen",
"focus": [
0.63,
0.03,
0.28,
0.94
]
},
{
"key": "tai-chi",
"from": 19,
"to": 30,
"at": 24.5,
"focal": "24-form Tai Chi app screen",
"focus": [
0.63,
0.03,
0.28,
0.94
]
},
{
"key": "habits",
"from": 30,
"to": 40,
"at": 35.0,
"focal": "Habit rewards app screen",
"focus": [
0.63,
0.03,
0.28,
0.94
]
},
{
"key": "diary",
"from": 40,
"to": 50,
"at": 45.0,
"focal": "Diary app screen",
"focus": [
0.63,
0.03,
0.28,
0.94
]
},
{
"key": "lumi",
"from": 50,
"to": 61,
"at": 55.5,
"focal": "Lumi app screen",
"focus": [
0.63,
0.03,
0.28,
0.94
]
},
{
"key": "closing",
"from": 61,
"to": 69,
"at": 65.0,
"focal": "Closing app screen",
"focus": [
0.63,
0.03,
0.28,
0.94
]
}
],
"narration": {
"voice": "Algieba",
"takes": 3,
"minimum_match": 0.9,
"approval": "pending-owner-review",
"lines": [],
"draft_lines": [
{
"key": "opening-1",
"text": "A little space for yourself.",
"at": 0.9
},
{
"key": "opening-2",
"text": "New ways to move, breathe, and find a quieter moment.",
"at": 3.6
},
{
"key": "workout-1",
"text": "Seven minutes of movement.",
"at": 10
},
{
"key": "workout-2",
"text": "Twelve exercises, an animated guide, and time to rest.",
"at": 13.3
},
{
"key": "tai-chi-1",
"text": "Follow twenty-four-form Tai Chi, one movement at a time.",
"at": 20
},
{
"key": "tai-chi-2",
"text": "Return to the parts you want to practise.",
"at": 24.7
},
{
"key": "habits-1",
"text": "Let little habits earn little rewards.",
"at": 31
},
{
"key": "habits-2",
"text": "Collect coins, then spend them on treats you choose.",
"at": 34.9
},
{
"key": "diary-1",
"text": "Keep a little of today.",
"at": 41
},
{
"key": "diary-2",
"text": "Write in Markdown, and keep photos beside the moments you record.",
"at": 43.9
},
{
"key": "lumi-1",
"text": "Lumi is here when you need a little help.",
"at": 51
},
{
"key": "lumi-2",
"text": "Change a theme, start a practice, or find your way around.",
"at": 55.2
},
{
"key": "closing-1",
"text": "Inner Breeze. Make room for you.",
"at": 61.7
},
{
"key": "closing-2",
"text": "Begin with one small practice.",
"at": 65.3
}
]
}
}