Vidéo publicitaire : sources (animation, musique, voix off, mixage, rendu MP4) dans docs/video
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9421bd8141
commit
9a38adda7d
9 changed files with 1047 additions and 0 deletions
4
docs/video/.gitignore
vendored
Normal file
4
docs/video/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
node_modules/
|
||||||
|
vo/
|
||||||
|
music.wav
|
||||||
|
*.mp4
|
||||||
37
docs/video/README.md
Normal file
37
docs/video/README.md
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Vidéo publicitaire MonEspacePro
|
||||||
|
|
||||||
|
Pub de 30 s au format vertical 1080 × 1920 (TikTok, Instagram Reels), avec musique originale et voix off.
|
||||||
|
Les vidéos finales sont dans `docs/` (`MonEspacePro-pub-voix-120fps.mp4`).
|
||||||
|
|
||||||
|
| Fichier | Rôle |
|
||||||
|
|---|---|
|
||||||
|
| `video-pub.html` | L'animation (HTML/CSS/JS). Ouvrir dans Chrome ; `?t=12.5` fige l'image à 12,5 s, Espace relance. |
|
||||||
|
| `music.js` | Compose la musique (120 BPM, calée sur les temps forts) → `music.wav` |
|
||||||
|
| `voice.js` | Génère la voix off phrase par phrase (voix Microsoft « Denise ») → `vo/` |
|
||||||
|
| `mix.js` | Mixe voix et musique, la musique baisse sous la voix → `mix.wav` |
|
||||||
|
| `render.js` | Rend l'animation image par image dans Chrome et assemble le MP4 avec `mix.wav` |
|
||||||
|
| `mix.wav` | Bande son finale (versionnée : le rendu fonctionne sans régénérer la voix) |
|
||||||
|
|
||||||
|
## Refaire la vidéo
|
||||||
|
|
||||||
|
Prérequis : Node.js et Google Chrome installé à l'emplacement standard.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
npm run rendu:60 # → docs/MonEspacePro-pub-voix-60fps.mp4 (≈ 2 min)
|
||||||
|
npm run rendu:120 # → docs/MonEspacePro-pub-voix-120fps.mp4 (≈ 4 min)
|
||||||
|
```
|
||||||
|
|
||||||
|
Après une modification du texte de la voix off ou de la musique : `npm run musique`, `npm run voix`,
|
||||||
|
`npm run mixage`, puis le rendu.
|
||||||
|
|
||||||
|
## À savoir
|
||||||
|
|
||||||
|
- Les temps forts sont repérés par `♪` dans la timeline de `video-pub.html` ; la voix off est calée
|
||||||
|
dans le tableau `LINES` de `voice.js` (début, fin maximale, texte, débit).
|
||||||
|
- Les cartes affichées reproduisent les vraies cartes Apple Wallet générées par l'API
|
||||||
|
(`backend/src/wallet`) : même champs, même texte de prochaine récompense.
|
||||||
|
- La voix vient du service de lecture à voix haute de Microsoft Edge, prévu pour un usage personnel.
|
||||||
|
Pour une campagne payante, régénérer la voix avec une offre sous licence commerciale (Azure Speech,
|
||||||
|
même voix « Denise », ou ElevenLabs), puis relancer `npm run mixage` et le rendu.
|
||||||
|
- TikTok et Instagram diffusent au plus en 60 images/s : publier la version 60 i/s.
|
||||||
39
docs/video/mix.js
Normal file
39
docs/video/mix.js
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
// Mixage voix off + musique, avec baisse automatique de la musique sous la voix
|
||||||
|
process.chdir(__dirname);
|
||||||
|
const fs = require('fs');
|
||||||
|
const SR = 48000;
|
||||||
|
const wav = fs.readFileSync('music.wav');
|
||||||
|
const N = (wav.length - 44) / 4;
|
||||||
|
const L = new Float32Array(N), R = new Float32Array(N), V = new Float32Array(N);
|
||||||
|
for (let k = 0; k < N; k++) { L[k] = wav.readInt16LE(44 + k * 4) / 32768; R[k] = wav.readInt16LE(46 + k * 4) / 32768; }
|
||||||
|
|
||||||
|
// voix : chaque réplique normalisée puis posée à son instant
|
||||||
|
for (const { t, wav: f } of JSON.parse(fs.readFileSync('vo/plan.json'))) {
|
||||||
|
const b = fs.readFileSync(f), n = (b.length - 44) / 2;
|
||||||
|
let pk = 0; const s = new Float32Array(n);
|
||||||
|
for (let i = 0; i < n; i++) { s[i] = b.readInt16LE(44 + i * 2) / 32768; pk = Math.max(pk, Math.abs(s[i])); }
|
||||||
|
const g = .9 / pk, s0 = Math.round(t * SR);
|
||||||
|
for (let i = 0; i < n; i++) if (s0 + i < N) V[s0 + i] += s[i] * g;
|
||||||
|
}
|
||||||
|
// compression légère de la voix (plus présente sur un téléphone)
|
||||||
|
{ let env = 0; for (let k = 0; k < N; k++) { const a = Math.abs(V[k]); env = a > env ? env + (a - env) * .01 : env + (a - env) * .0003; const over = Math.max(0, env - .35); V[k] *= (env > .35 ? (.35 + over * .4) / env : 1) * 1.5; } }
|
||||||
|
|
||||||
|
// enveloppe de présence de la voix → baisse de la musique à -10 dB (attaque 40 ms, relâche 300 ms)
|
||||||
|
const duck = new Float32Array(N);
|
||||||
|
{ let e = 0; const att = 1 - Math.exp(-1 / (.04 * SR)), rel = 1 - Math.exp(-1 / (.3 * SR));
|
||||||
|
// anticipation de 60 ms pour que la musique baisse juste avant le premier mot
|
||||||
|
const look = Math.round(.06 * SR);
|
||||||
|
for (let k = 0; k < N; k++) { const a = Math.abs(V[Math.min(N - 1, k + look)]) > .02 ? 1 : 0; e += (a - e) * (a > e ? att : rel); duck[k] = 1 - .68 * e; } }
|
||||||
|
|
||||||
|
let pk = 0;
|
||||||
|
for (let k = 0; k < N; k++) {
|
||||||
|
L[k] = Math.tanh(L[k] * duck[k] * .9 + V[k]); R[k] = Math.tanh(R[k] * duck[k] * .9 + V[k]);
|
||||||
|
pk = Math.max(pk, Math.abs(L[k]), Math.abs(R[k]));
|
||||||
|
}
|
||||||
|
const g = .89 / pk, out = Buffer.alloc(44 + N * 4);
|
||||||
|
out.write('RIFF', 0); out.writeUInt32LE(36 + N * 4, 4); out.write('WAVE', 8); out.write('fmt ', 12);
|
||||||
|
out.writeUInt32LE(16, 16); out.writeUInt16LE(1, 20); out.writeUInt16LE(2, 22); out.writeUInt32LE(SR, 24);
|
||||||
|
out.writeUInt32LE(SR * 4, 28); out.writeUInt16LE(4, 32); out.writeUInt16LE(16, 34); out.write('data', 36); out.writeUInt32LE(N * 4, 40);
|
||||||
|
for (let k = 0; k < N; k++) { out.writeInt16LE(Math.round(L[k] * g * 32767), 44 + k * 4); out.writeInt16LE(Math.round(R[k] * g * 32767), 46 + k * 4); }
|
||||||
|
fs.writeFileSync('mix.wav', out);
|
||||||
|
console.log('mix.wav ok');
|
||||||
BIN
docs/video/mix.wav
Normal file
BIN
docs/video/mix.wav
Normal file
Binary file not shown.
145
docs/video/music.js
Normal file
145
docs/video/music.js
Normal file
|
|
@ -0,0 +1,145 @@
|
||||||
|
// Musique originale 120 BPM, 30 s, calée sur les temps forts de video-pub.html
|
||||||
|
process.chdir(__dirname);
|
||||||
|
const fs = require('fs');
|
||||||
|
const SR = 48000, DUR = 30, N = SR * DUR;
|
||||||
|
const L = new Float32Array(N), R = new Float32Array(N);
|
||||||
|
const BEAT = 0.5;
|
||||||
|
let seed = 12345; const rnd = () => (seed = (seed * 1664525 + 1013904223) >>> 0) / 4294967296;
|
||||||
|
const mtof = m => 440 * Math.pow(2, (m - 69) / 12);
|
||||||
|
function add(t, dur, fn, pan = 0, buf = null) {
|
||||||
|
const s0 = Math.floor(t * SR), n = Math.floor(dur * SR);
|
||||||
|
const gl = Math.cos((pan + 1) * Math.PI / 4), gr = Math.sin((pan + 1) * Math.PI / 4);
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
const k = s0 + i; if (k < 0 || k >= N) continue;
|
||||||
|
const v = fn(i / SR, i);
|
||||||
|
if (buf) { buf[k] += v; continue; }
|
||||||
|
L[k] += v * gl * 1.41; R[k] += v * gr * 1.41;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const inRange = (t, rs) => rs.some(([a, b]) => t >= a - 1e-6 && t < b - 1e-6);
|
||||||
|
|
||||||
|
/* ---------- Sections ---------- */
|
||||||
|
const DRUMS = [[0, 6], [8, 29.5]];
|
||||||
|
const DROP = [[8, 12], [15, 18], [22, 29.5]]; // arpège lead
|
||||||
|
const PADS = [[0, 30]];
|
||||||
|
const CHORDS = [[57, 60, 64], [53, 57, 60], [52, 55, 60], [55, 59, 62]]; // Am F C G
|
||||||
|
const ROOTS = [45, 41, 48, 43];
|
||||||
|
const chordAt = t => Math.floor(t / 2) % 4;
|
||||||
|
|
||||||
|
/* ---------- Sidechain ---------- */
|
||||||
|
const kicks = [];
|
||||||
|
for (let t = 0; t < DUR; t += BEAT) if (inRange(t, DRUMS)) kicks.push(t);
|
||||||
|
const duck = new Float32Array(N).fill(1);
|
||||||
|
for (const tk of kicks) for (let i = 0; i < SR * .4; i++) { const k = Math.floor(tk * SR) + i; if (k < N) duck[k] = Math.min(duck[k], 1 - .65 * Math.exp(-i / SR / .11)); }
|
||||||
|
|
||||||
|
/* ---------- Batterie ---------- */
|
||||||
|
function kick(t, g = 1) {
|
||||||
|
let ph = 0;
|
||||||
|
add(t, .45, (x) => { const f = 45 + 110 * Math.exp(-x / .04); ph += 2 * Math.PI * f / SR; return g * .95 * Math.sin(ph) * Math.exp(-x / .16) + g * .3 * (rnd() * 2 - 1) * Math.exp(-x / .004); });
|
||||||
|
}
|
||||||
|
function clap(t, g = 1) {
|
||||||
|
let lp = 0, prev = 0;
|
||||||
|
add(t, .3, (x) => { const n = rnd() * 2 - 1; const hp = n - prev; prev = n; lp += (hp - lp) * .5; const env = (x < .03 ? (Math.exp(-(x % .01) / .003)) : 1) * Math.exp(-x / .09); return g * .5 * lp * env + g * .18 * Math.sin(2 * Math.PI * 190 * x) * Math.exp(-x / .05); }, (rnd() - .5) * .3);
|
||||||
|
}
|
||||||
|
function hat(t, g = 1, open = false) {
|
||||||
|
let prev = 0;
|
||||||
|
add(t, open ? .25 : .06, (x) => { const n = rnd() * 2 - 1; const hp = n - prev; prev = n; return g * .22 * hp * Math.exp(-x / (open ? .08 : .018)); }, .35);
|
||||||
|
}
|
||||||
|
for (let t = 0; t < DUR; t += .125) {
|
||||||
|
if (!inRange(t, DRUMS)) continue;
|
||||||
|
const b = Math.round(t / .125) % 8;
|
||||||
|
if (b % 4 === 0) kick(t);
|
||||||
|
if (b === 4) clap(t);
|
||||||
|
if (b === 2 || b === 6) hat(t, 1, inRange(t, DROP));
|
||||||
|
else hat(t, .45);
|
||||||
|
}
|
||||||
|
// roulement de caisse claire avant les ruptures (5,0→6,0 et 7,0→8,0, 14,0→15,0)
|
||||||
|
for (const [a, b] of [[5, 6], [7, 8], [14, 15], [25, 26]]) {
|
||||||
|
for (let t = a; t < b - 1e-6;) { const p = (t - a) / (b - a); clap(t, .35 + .6 * p); t += p < .5 ? .125 : .0625; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Basse ---------- */
|
||||||
|
for (let t = 0; t < 29.5; t += .25) {
|
||||||
|
if (!inRange(t, DRUMS)) continue;
|
||||||
|
const b = Math.round(t / .25) % 2; if (b === 0 && !inRange(t, DROP)) continue;
|
||||||
|
const f = mtof(ROOTS[chordAt(t)] - 12 + (b ? 12 : 0) * 0), d = .22;
|
||||||
|
let ph = 0, lp = 0;
|
||||||
|
add(t, d, (x) => { ph = (ph + f / SR) % 1; const saw = 2 * ph - 1; const cut = .02 + .25 * Math.exp(-x / .05); lp += (saw - lp) * cut; return .55 * lp * Math.min(1, x / .004) * Math.exp(-x / .25) * (x > d - .01 ? (d - x) / .01 : 1); });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Pad supersaw (pompé par le kick) ---------- */
|
||||||
|
const pad = new Float32Array(N), padR = new Float32Array(N);
|
||||||
|
for (let bar = 0; bar < 15; bar++) {
|
||||||
|
const t = bar * 2; if (!inRange(t, PADS)) continue;
|
||||||
|
const notes = CHORDS[bar % 4];
|
||||||
|
for (const m of notes) for (const det of [-.12, 0, .11]) {
|
||||||
|
const f = mtof(m + det); let ph = rnd(), lp = 0;
|
||||||
|
const brk = inRange(t, [[6, 8]]);
|
||||||
|
add(t, 2.05, (x) => { ph = (ph + f / SR) % 1; lp += ((2 * ph - 1) - lp) * (brk ? .03 + .05 * (x / 2) : .09); return .055 * lp * Math.min(1, x / .02) * (x > 1.98 ? Math.max(0, (2.05 - x) / .07) : 1); }, 0, det < 0 ? pad : padR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let k = 0; k < N; k++) { const g = (inRange(k / SR, [[6, 8]]) ? 1.6 : 1) * duck[k]; L[k] += (pad[k] * .8 + padR[k] * .2) * g; R[k] += (padR[k] * .8 + pad[k] * .2) * g; }
|
||||||
|
|
||||||
|
/* ---------- Arpège lead (sections drop) + délai ---------- */
|
||||||
|
const lead = new Float32Array(N);
|
||||||
|
for (let t = 0; t < DUR; t += .125) {
|
||||||
|
if (!inRange(t, DROP)) continue;
|
||||||
|
const c = CHORDS[chordAt(t)], i = Math.round(t / .125) % 8;
|
||||||
|
const m = c[[0, 1, 2, 1, 0, 2, 1, 2][i]] + 12 + (i === 7 ? 12 : 0), f = mtof(m);
|
||||||
|
let ph = 0, lp = 0;
|
||||||
|
add(t, .2, (x) => { ph = (ph + f / SR) % 1; const sq = ph < .5 ? 1 : -1; lp += (sq - lp) * (.05 + .3 * Math.exp(-x / .03)); return .08 * lp * Math.exp(-x / .07); }, 0, lead);
|
||||||
|
}
|
||||||
|
{ const d = Math.floor(.375 * SR); for (let k = 0; k < N; k++) { const dl = k >= d ? lead[k - d] : 0; const dr = k >= 2 * d ? lead[k - 2 * d] : 0; L[k] += (lead[k] + .45 * dl) * duck[k]; R[k] += (lead[k] + .35 * dr) * duck[k]; } }
|
||||||
|
|
||||||
|
/* ---------- Effets synchronisés à l'image ---------- */
|
||||||
|
function boom(t, g = 1) { let ph = 0; add(t, 1.6, (x) => { const f = 38 + 80 * Math.exp(-x / .06); ph += 2 * Math.PI * f / SR; return g * (.8 * Math.sin(ph) * Math.exp(-x / .5) + .25 * (rnd() * 2 - 1) * Math.exp(-x / .08)); }); }
|
||||||
|
function whoosh(t, d = .35, g = 1) { let lp = 0; add(t - d * .7, d, (x) => { const p = x / d; lp += ((rnd() * 2 - 1) - lp) * (.02 + .5 * p * p); return g * .5 * lp * Math.sin(Math.PI * p); }, 0); }
|
||||||
|
function riser(a, b, g = 1) { let lp = 0, ph = 0; add(a, b - a, (x) => { const p = x / (b - a); lp += ((rnd() * 2 - 1) - lp) * (.01 + .4 * p * p); ph = (ph + (200 + 1400 * p * p) / SR) % 1; return g * (.35 * lp + .05 * (2 * ph - 1)) * p * p; }); }
|
||||||
|
function bell(t, m, g = 1, d = .6) { const f = mtof(m); add(t, d, (x) => g * .22 * (Math.sin(2 * Math.PI * f * x) + .35 * Math.sin(2 * Math.PI * f * 2.01 * x) * Math.exp(-x / .08)) * Math.exp(-x / (d / 4)), (rnd() - .5) * .4); }
|
||||||
|
function beep(t, f, d = .07) { add(t, d, (x) => .16 * Math.sin(2 * Math.PI * f * x) * (x < .005 ? x / .005 : 1) * (x > d - .01 ? (d - x) / .01 : 1)); }
|
||||||
|
function boing(t) { let ph = 0; add(t, .35, (x) => { const f = 300 + 500 * Math.exp(-x / .06) * (1 + .2 * Math.sin(2 * Math.PI * 18 * x)); ph += 2 * Math.PI * f / SR; return .2 * Math.sin(ph) * Math.exp(-x / .12); }); }
|
||||||
|
|
||||||
|
boom(0, .9); // 0,0 accroche
|
||||||
|
kick(.5, 1.2); boom(.5, .6); // 0,5 impact du tampon
|
||||||
|
whoosh(1.9, .25); // 1,9 whip pan
|
||||||
|
boom(2.5, .6); // 2,5 CARTON
|
||||||
|
boom(3, .4); whoosh(4, .15, .6); whoosh(5.07, .25); // slam / coupe / whip vertical
|
||||||
|
for (const t of [3.5, 4.5, 5.5]) clap(t, 1.1); // traits rouges
|
||||||
|
riser(4.5, 6, .9); boom(6, 1.1); // rupture verte
|
||||||
|
bell(6.25, 81, .7, 1.2); bell(7.5, 88, .7, 1.2); // « Et si… » / « téléphone ? »
|
||||||
|
riser(7, 8, .7); boom(8, .9); // drop comptoir
|
||||||
|
boing(8.5); kick(9, .8); // téléphone qui arrive / se pose
|
||||||
|
beep(9.5, 1975); beep(9.6, 2637, .1); // bip du scan
|
||||||
|
whoosh(10.42, .2, .6);
|
||||||
|
riser(11, 12, .6); whoosh(12.1, .35, 1); // zoom à travers l'écran
|
||||||
|
bell(13, 76, .8); bell(13.5, 81, .6); bell(14, 84, .6); // carte dans le Wallet + pastilles
|
||||||
|
whoosh(15.05, .3, .8); // volet diagonal
|
||||||
|
[15.5, 16.25, 16.75, 17.25, 17.5, 17.75].forEach((t, i) => { bell(t, [69, 72, 74, 76, 79, 81][i], .9, .5); kick(t, .5); });
|
||||||
|
boom(18, 1.2); bell(18, 84, 1, 1.4); bell(18, 88, .8, 1.4); bell(18.06, 93, .6, 1.4); // 10/10 confettis
|
||||||
|
for (let i = 0; i < 26; i++) hat(18 + i * .03 + rnd() * .02, .7, true);
|
||||||
|
bell(18.5, 88, .6);
|
||||||
|
whoosh(20.07, .25); // whip pan
|
||||||
|
bell(20.75, 88, .8, .5); bell(20.87, 93, .8, .7); // notification
|
||||||
|
boom(22, .8); // flash
|
||||||
|
bell(22.35, 81, .5); bell(23.3, 84, .5); bell(24.55, 88, .5); // coches
|
||||||
|
for (let i = 0; i < 12; i++) beep(24.65 + i * .05, 1200 + i * 90, .03); // compteur 0 → 19 €
|
||||||
|
bell(25.25, 93, .9, .9); bell(25.25, 88, .6, .9);
|
||||||
|
boom(26, .7); whoosh(26.1, .3, .6); // signature
|
||||||
|
boing(26.5); boom(26.5, .5); // point jaune
|
||||||
|
bell(27.25, 81, .5); bell(27.75, 88, .5);
|
||||||
|
riser(28.5, 29.5, .7);
|
||||||
|
boom(29.5, .5); kick(29.75, 1); boom(29.75, .7); // la carte retombe (raccord boucle)
|
||||||
|
|
||||||
|
/* ---------- Master ---------- */
|
||||||
|
let peak = 0;
|
||||||
|
for (let k = 0; k < N; k++) { L[k] = Math.tanh(L[k] * 1.3); R[k] = Math.tanh(R[k] * 1.3); peak = Math.max(peak, Math.abs(L[k]), Math.abs(R[k])); }
|
||||||
|
const norm = .89 / peak;
|
||||||
|
// micro fondu de 5 ms aux extrémités
|
||||||
|
for (let k = 0; k < 240; k++) { const g = k / 240; L[k] *= g; R[k] *= g; L[N - 1 - k] *= g; R[N - 1 - k] *= g; }
|
||||||
|
const out = Buffer.alloc(44 + N * 4);
|
||||||
|
out.write('RIFF', 0); out.writeUInt32LE(36 + N * 4, 4); out.write('WAVE', 8); out.write('fmt ', 12);
|
||||||
|
out.writeUInt32LE(16, 16); out.writeUInt16LE(1, 20); out.writeUInt16LE(2, 22); out.writeUInt32LE(SR, 24);
|
||||||
|
out.writeUInt32LE(SR * 4, 28); out.writeUInt16LE(4, 32); out.writeUInt16LE(16, 34); out.write('data', 36); out.writeUInt32LE(N * 4, 40);
|
||||||
|
for (let k = 0; k < N; k++) { out.writeInt16LE(Math.round(Math.max(-1, Math.min(1, L[k] * norm)) * 32767), 44 + k * 4); out.writeInt16LE(Math.round(Math.max(-1, Math.min(1, R[k] * norm)) * 32767), 46 + k * 4); }
|
||||||
|
fs.writeFileSync('music.wav', out);
|
||||||
|
console.log('music.wav ok, peak avant normalisation', peak.toFixed(2));
|
||||||
17
docs/video/package.json
Normal file
17
docs/video/package.json
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "monespacepro-video",
|
||||||
|
"private": true,
|
||||||
|
"description": "Vidéo publicitaire MonEspacePro : animation, musique, voix off et rendu MP4",
|
||||||
|
"scripts": {
|
||||||
|
"musique": "node music.js",
|
||||||
|
"voix": "node voice.js",
|
||||||
|
"mixage": "node mix.js",
|
||||||
|
"rendu:60": "node render.js 60 ../MonEspacePro-pub-voix-60fps.mp4",
|
||||||
|
"rendu:120": "node render.js 120 ../MonEspacePro-pub-voix-120fps.mp4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ffmpeg-static": "^5.3.0",
|
||||||
|
"msedge-tts": "^2.0.9",
|
||||||
|
"playwright-core": "^1.63.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
35
docs/video/render.js
Normal file
35
docs/video/render.js
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Rendu image par image de video-pub.html → MP4 (voix off + musique).
|
||||||
|
// Usage : node render.js <images/s> <sortie.mp4> [audio.wav, par défaut mix.wav]
|
||||||
|
process.chdir(__dirname);
|
||||||
|
const { chromium } = require('playwright-core');
|
||||||
|
const ffmpeg = require('ffmpeg-static');
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const FPS = +process.argv[2] || 120;
|
||||||
|
const OUT = require('path').resolve(process.argv[3] || `MonEspacePro-pub-${FPS}fps.mp4`);
|
||||||
|
const SRC = require('url').pathToFileURL(__dirname + '/video-pub.html').href + '?t=0';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const browser = await chromium.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: true });
|
||||||
|
const page = await browser.newPage({ viewport: { width: 1080, height: 1920 }, deviceScaleFactor: 1 });
|
||||||
|
await page.goto(SRC);
|
||||||
|
await page.waitForFunction(() => typeof seek === 'function' && typeof A !== 'undefined' && A.length > 100 && document.fonts.check('800 100px Figtree'));
|
||||||
|
await page.addStyleTag({ content: '#replay{display:none!important}' });
|
||||||
|
const ff = spawn(ffmpeg, ['-y', '-hide_banner', '-loglevel', 'error',
|
||||||
|
'-f', 'image2pipe', '-framerate', String(FPS), '-c:v', 'mjpeg', '-i', '-',
|
||||||
|
'-i', process.argv[4] || 'mix.wav',
|
||||||
|
'-c:v', 'libx264', '-preset', 'slow', '-crf', '17', '-pix_fmt', 'yuv420p', '-profile:v', 'high',
|
||||||
|
'-r', String(FPS), '-c:a', 'aac', '-b:a', '192k', '-ar', '48000', '-shortest', '-movflags', '+faststart', OUT],
|
||||||
|
{ stdio: ['pipe', 'inherit', 'inherit'] });
|
||||||
|
const total = FPS * 30;
|
||||||
|
const t0 = Date.now();
|
||||||
|
for (let i = 0; i < total; i++) {
|
||||||
|
await page.evaluate(t => { seek(t); return new Promise(r => requestAnimationFrame(() => r())); }, i / FPS);
|
||||||
|
const buf = await page.screenshot({ type: 'jpeg', quality: 95, clip: { x: 0, y: 0, width: 1080, height: 1920 } });
|
||||||
|
if (!ff.stdin.write(buf)) await new Promise(r => ff.stdin.once('drain', r));
|
||||||
|
if (i % (FPS * 2) === 0) console.log(`${(i / FPS).toFixed(0)} s / 30 — ${((Date.now() - t0) / 1000).toFixed(0)} s écoulées`);
|
||||||
|
}
|
||||||
|
ff.stdin.end();
|
||||||
|
await new Promise(r => ff.on('close', r));
|
||||||
|
await browser.close();
|
||||||
|
console.log('Terminé :', OUT);
|
||||||
|
})();
|
||||||
710
docs/video/video-pub.html
Normal file
710
docs/video/video-pub.html
Normal file
|
|
@ -0,0 +1,710 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
MonEspacePro — vidéo publicitaire motion design 30 s (TikTok / Instagram Reels, 9:16, 1080 × 1920)
|
||||||
|
|
||||||
|
EXPORT — obtenir la vidéo
|
||||||
|
1. Ouvrir ce fichier dans Google Chrome.
|
||||||
|
2. Régler la fenêtre (plein écran F11 conseillé) pour que la scène verticale soit entièrement visible.
|
||||||
|
Astuce : sur un écran 1080p, la scène s'affiche en ~608 × 1080 ; pour une sortie nette, utiliser un écran
|
||||||
|
vertical ou un zoom Chrome à 50 % sur un écran 4K, ou ajouter ?t=0 pour vérifier le cadrage avant d'enregistrer.
|
||||||
|
3. Lancer l'enregistrement d'écran (Outil Capture d'écran de Windows en mode vidéo, Xbox Game Bar, ou OBS
|
||||||
|
avec une source « Capture de fenêtre »), puis appuyer sur Espace (ou « Rejouer ») pour relancer depuis le début.
|
||||||
|
4. Enregistrer les 30 s, arrêter.
|
||||||
|
5. Dans CapCut : recadrer la vidéo en 1080 × 1920 sur la scène, couper au début du premier mouvement et à 30 s,
|
||||||
|
ajouter une musique énergique à 120 BPM (1 temps = 0,5 s) et caler les coupes sur les instants « ♪ » indiqués
|
||||||
|
dans la timeline du script ci-dessous.
|
||||||
|
|
||||||
|
Outils de vérification : ajouter ?t=12.5 à l'URL pour figer l'animation à 12,5 s.
|
||||||
|
-->
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<title>MonEspacePro — pub 30 s</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Figtree:wght@600;700;800&display=block" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
:root{--g:#0E7A66;--gl:#EAF6F2;--y:#F2B544;--bg:#F6F6F3;--ink:#1C1C19;--gr:#5F5E56;--brick:#A64B17;--cream:#FFF4E4;--dot:#F7D58B;--red:#E04B3A}
|
||||||
|
*{box-sizing:border-box;margin:0;padding:0}
|
||||||
|
html,body{width:100%;height:100%;background:#000;overflow:hidden}
|
||||||
|
body{font-family:'Figtree',system-ui,sans-serif;-webkit-font-smoothing:antialiased}
|
||||||
|
#stage{position:absolute;left:50%;top:50%;width:1080px;height:1920px;margin:-960px 0 0 -540px;overflow:hidden;background:var(--bg);color:var(--ink)}
|
||||||
|
#shake,#fx{position:absolute;inset:0}
|
||||||
|
#fx{pointer-events:none;z-index:50;left:50px;right:-50px}
|
||||||
|
#flash{position:absolute;inset:0;background:#fff;opacity:0;z-index:100;pointer-events:none}
|
||||||
|
#clock{position:absolute;width:1px;height:1px;opacity:0}
|
||||||
|
.scene{position:absolute;inset:0;visibility:hidden;overflow:hidden}
|
||||||
|
/* le contenu est dessiné autour de x = 490 ; la caméra le décale de 50 px pour le centrer sur la scène (x = 540) */
|
||||||
|
.cam{position:absolute;top:0;bottom:0;left:50px;right:-50px;transform-origin:490px 900px}
|
||||||
|
.abs{position:absolute}
|
||||||
|
.h{opacity:0}
|
||||||
|
.line{position:absolute;left:40px;width:900px;text-align:center;font-weight:800;letter-spacing:-.02em;line-height:1;white-space:nowrap}
|
||||||
|
.w{display:inline-block;position:relative}
|
||||||
|
.hl{display:inline-block;background:var(--y);color:var(--ink);padding:0 .1em .05em;border-radius:.14em}
|
||||||
|
.strike{position:absolute;left:-6%;width:112%;top:52%;height:.13em;margin-top:-.065em;background:var(--red);border-radius:99px;transform-origin:0 50%;transform:rotate(-5deg) scaleX(0)}
|
||||||
|
|
||||||
|
/* Étincelles et confettis */
|
||||||
|
.sp{position:absolute;width:10px;height:44px;margin-left:-5px;border-radius:5px;background:var(--ink);opacity:0;transform-origin:5px 0}
|
||||||
|
.sp.dotsp{width:24px;height:24px;margin-left:-12px;border-radius:50%;background:var(--y);transform-origin:12px 0}
|
||||||
|
.cf{position:absolute;opacity:0;border-radius:4px}
|
||||||
|
|
||||||
|
/* Carte en carton */
|
||||||
|
.cbox{position:absolute}
|
||||||
|
.carton{position:absolute;left:0;top:0;width:820px;height:520px;border-radius:28px;background:linear-gradient(160deg,#EEDDB6,#E0C998);box-shadow:0 30px 60px rgba(60,40,10,.22),inset 0 0 0 2px rgba(120,90,40,.15);color:#6B4A2B;overflow:hidden;transform-origin:50% 50%}
|
||||||
|
.carton .ct{position:absolute;left:0;right:0;top:54px;text-align:center;font-weight:800;font-size:46px;letter-spacing:.06em}
|
||||||
|
.carton .cs{position:absolute;left:0;right:0;top:118px;text-align:center;font-weight:600;font-size:28px;opacity:.75}
|
||||||
|
.carton .slots{position:absolute;left:86px;top:200px;display:grid;grid-template-columns:repeat(5,104px);gap:32px}
|
||||||
|
.carton .slot{width:104px;height:104px;border-radius:50%;border:4px dashed rgba(107,74,43,.45);position:relative}
|
||||||
|
.ink{position:absolute;inset:-4px;border-radius:50%;border:7px solid #8C2F39;display:flex;align-items:center;justify-content:center;transform:rotate(-14deg);opacity:.85}
|
||||||
|
.ink svg{width:54px;height:54px}
|
||||||
|
.cfold{position:absolute;right:0;top:0;width:96px;height:96px;border-bottom-left-radius:14px;box-shadow:-6px 6px 10px rgba(0,0,0,.08)}
|
||||||
|
.crease{position:absolute;inset:0;opacity:0}
|
||||||
|
|
||||||
|
/* Tampon encreur */
|
||||||
|
#stamp{left:545px;top:743px;width:160px;height:232px;transform:translateY(-1300px);transform-origin:50% 100%}
|
||||||
|
#stamp .knob{position:absolute;left:45px;top:0;width:70px;height:70px;border-radius:50%;background:#6B3E1F}
|
||||||
|
#stamp .neck{position:absolute;left:58px;top:50px;width:44px;height:84px;background:#7E4C26;border-radius:10px}
|
||||||
|
#stamp .body{position:absolute;left:0;top:126px;width:160px;height:84px;background:#9A6232;border-radius:18px;box-shadow:inset 0 -10px 0 rgba(0,0,0,.12)}
|
||||||
|
#stamp .rub{position:absolute;left:8px;top:208px;width:144px;height:24px;background:#8C2F39;border-radius:0 0 10px 10px}
|
||||||
|
|
||||||
|
/* Main stylisée */
|
||||||
|
#hand{left:340px;top:900px;width:300px;height:1100px;transform:translateY(1100px)}
|
||||||
|
#hand .fing{position:absolute;top:0;width:58px;height:190px;background:#F2C9A0;border-radius:29px;transform-origin:50% 100%}
|
||||||
|
#hand .palm{position:absolute;left:20px;top:120px;width:260px;height:240px;background:#F2C9A0;border-radius:110px 110px 90px 90px}
|
||||||
|
#hand .thumb{position:absolute;left:-40px;top:190px;width:160px;height:62px;border-radius:31px;background:#E9BB8E;transform:rotate(-32deg)}
|
||||||
|
#hand .sleeve{position:absolute;left:30px;top:330px;width:240px;height:800px;background:var(--g);border-radius:30px}
|
||||||
|
|
||||||
|
/* Carte Boulangerie Kerlann (dessinée en 840 × 530, mise à l'échelle) */
|
||||||
|
.kbox{position:absolute}
|
||||||
|
.kc{position:absolute;left:0;top:0;width:840px;height:530px;border-radius:40px;background:var(--brick);color:var(--cream);box-shadow:0 30px 70px rgba(80,30,5,.35);overflow:hidden;transform-origin:0 0}
|
||||||
|
.kc .kl{position:absolute;left:44px;top:40px;width:92px;height:92px;border-radius:50%;background:var(--cream);color:var(--brick);font-weight:800;font-size:38px;display:flex;align-items:center;justify-content:center;letter-spacing:-.02em}
|
||||||
|
.kc .kn{position:absolute;left:156px;top:44px;font-weight:800;font-size:46px;letter-spacing:-.02em;white-space:nowrap}
|
||||||
|
.kc .ks{position:absolute;left:156px;top:100px;font-weight:600;font-size:26px;opacity:.75}
|
||||||
|
.kc .kd{position:absolute;left:44px;top:172px;display:grid;grid-template-columns:repeat(5,88px);gap:26px}
|
||||||
|
.kc .d{width:88px;height:88px;border-radius:50%;border:4px dashed rgba(255,244,228,.45);position:relative}
|
||||||
|
.kc .f{position:absolute;inset:-4px;border-radius:50%;background:var(--dot);display:flex;align-items:center;justify-content:center}
|
||||||
|
.kc .f svg{width:48px;height:48px}
|
||||||
|
.kc .kr{position:absolute;left:44px;top:404px;font-size:24px;font-weight:700;opacity:.7;letter-spacing:.08em;text-transform:uppercase}
|
||||||
|
.kc .kv{position:absolute;left:30px;top:436px;font-size:40px;font-weight:800;padding:2px 14px;border-radius:12px;white-space:nowrap}
|
||||||
|
.kc .kq{position:absolute;right:44px;bottom:44px;width:130px;height:130px;background:#fff;border-radius:16px;padding:10px}
|
||||||
|
|
||||||
|
/* Vraie carte Apple Wallet (gabarit « Store Card » généré par l'API, 320 px de large) */
|
||||||
|
.pbox{position:absolute;left:0;top:0}
|
||||||
|
.pbox .wa{transform-origin:0 0}
|
||||||
|
.wa,.wg{width:320px;max-width:100%;overflow:hidden;box-shadow:0 18px 40px -16px rgba(0,0,0,.45);text-align:left;line-height:1.25}
|
||||||
|
.wa{border-radius:14px;font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif}
|
||||||
|
.wa small{display:block;font-size:10px;font-weight:600;letter-spacing:.02em}
|
||||||
|
.wa-h{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;height:50px}.wa-h b{font-weight:700;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||||
|
.wa-r{text-align:right}.wa-h .wa-r span{font-size:18px}
|
||||||
|
.wa-s{height:123px;background:rgba(255,255,255,.08);padding:0 14px 10px;display:flex;flex-direction:column;justify-content:flex-end}.wa-s small{font-size:11px}.wa-s span{font-size:36px;line-height:1}
|
||||||
|
.wa-2{display:flex;justify-content:space-between;gap:10px;padding:10px 14px}.wa-2 span,.wa-n span{font-size:14px}
|
||||||
|
.wa-n{padding:0 14px 6px}
|
||||||
|
.wa-q{display:flex;justify-content:center;padding:14px 0 20px}.wa-q i{display:block;background:#fff;padding:8px;border-radius:6px}.wa-q svg{display:block;width:120px;height:120px}
|
||||||
|
.wa-n{border-radius:8px;margin:0 6px;padding:0 8px 6px}
|
||||||
|
.rw{display:inline-block;height:1.25em;overflow:hidden;vertical-align:top}
|
||||||
|
.rs{display:block}
|
||||||
|
.rs>span{display:block;height:1.25em;line-height:1.25em;white-space:nowrap}
|
||||||
|
|
||||||
|
/* Téléphone */
|
||||||
|
.ph{position:absolute;background:var(--ink);border-radius:76px;box-shadow:0 40px 80px rgba(0,0,0,.28),inset 0 0 0 3px #3a3a36}
|
||||||
|
.ph .scr{position:absolute;inset:20px;border-radius:58px;overflow:hidden;background:#111}
|
||||||
|
.ph .isl{position:absolute;left:50%;top:34px;width:140px;height:40px;margin-left:-70px;background:#000;border-radius:20px;z-index:5}
|
||||||
|
|
||||||
|
.pill{display:inline-block;padding:22px 42px;border-radius:999px;font-weight:800;font-size:52px;letter-spacing:-.01em;box-shadow:0 18px 40px rgba(0,0,0,.18);white-space:nowrap}
|
||||||
|
.chk{position:absolute;left:400px;top:250px;width:180px;height:180px}
|
||||||
|
.chk path{stroke-dasharray:1;stroke-dashoffset:1}
|
||||||
|
|
||||||
|
/* Bouton Rejouer (hors scène) */
|
||||||
|
#replay{position:fixed;right:18px;bottom:18px;z-index:10;font:700 15px 'Figtree',sans-serif;color:#fff;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.25);border-radius:999px;padding:9px 18px;cursor:pointer;opacity:0;pointer-events:none;transition:opacity .3s}
|
||||||
|
#replay.on{opacity:.85;pointer-events:auto}
|
||||||
|
#replay:hover{opacity:1}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="stage">
|
||||||
|
<div id="shake">
|
||||||
|
|
||||||
|
<!-- ===== 3–4 s · Oubliée ===== -->
|
||||||
|
<section class="scene" id="s3a" style="background:var(--gl)">
|
||||||
|
<div class="cam" id="cam3a">
|
||||||
|
<div class="line" style="top:300px;font-size:200px"><span class="w h" id="w3a">Oubliée<i class="strike" id="k3a"></i></span></div>
|
||||||
|
<div class="abs" style="left:90px;top:900px;width:800px;height:420px">
|
||||||
|
<div class="abs" style="left:-200px;top:410px;width:1200px;height:10px;background:#CFE3DC;border-radius:5px"></div>
|
||||||
|
<div class="abs mini" id="mc3a" style="left:300px;top:270px;transform:translateX(-600px)"></div>
|
||||||
|
<div class="abs" style="left:60px;top:0;width:680px;height:240px;border-radius:50px;background:#6E8F86"></div>
|
||||||
|
<div class="abs" style="left:40px;top:190px;width:720px;height:130px;border-radius:36px;background:#5E7F77"></div>
|
||||||
|
<div class="abs" style="left:0;top:120px;width:130px;height:230px;border-radius:50px;background:#557269"></div>
|
||||||
|
<div class="abs" style="left:670px;top:120px;width:130px;height:230px;border-radius:50px;background:#557269"></div>
|
||||||
|
<div class="abs" style="left:60px;top:340px;width:30px;height:70px;border-radius:8px;background:#3E3A34"></div>
|
||||||
|
<div class="abs" style="left:710px;top:340px;width:30px;height:70px;border-radius:8px;background:#3E3A34"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 4–5 s · Perdue ===== -->
|
||||||
|
<section class="scene" id="s3b" style="background:#FDF0D5">
|
||||||
|
<div class="cam" id="cam3b">
|
||||||
|
<div class="line" style="top:300px;font-size:210px"><span class="w h" id="w3b">Perdue<i class="strike" id="k3b"></i></span></div>
|
||||||
|
<div class="abs" style="left:190px;top:760px;width:600px;height:680px;background:#fff;border-radius:28px;padding:26px;box-shadow:0 30px 60px rgba(90,60,0,.15);display:grid;grid-template-columns:1fr 1fr;gap:20px">
|
||||||
|
<div style="background:linear-gradient(#BFE3F1,#E4F4FA);border-radius:12px"></div>
|
||||||
|
<div style="background:linear-gradient(#BFE3F1,#E4F4FA);border-radius:12px;position:relative"><div class="abs" style="left:40px;top:70px;width:150px;height:46px;border-radius:23px;background:#fff"></div></div>
|
||||||
|
<div style="background:linear-gradient(#E4F4FA,#F4FBFD);border-radius:12px"></div>
|
||||||
|
<div style="background:linear-gradient(#E4F4FA,#F4FBFD);border-radius:12px"></div>
|
||||||
|
</div>
|
||||||
|
<div class="abs mini" id="mc3b" style="left:380px;top:1300px"></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 5–6 s · Jamais pleine ===== -->
|
||||||
|
<section class="scene" id="s3c" style="background:#2A2A26;color:#fff">
|
||||||
|
<div class="cam" id="cam3c">
|
||||||
|
<div class="line" style="top:270px;font-size:200px"><span class="w h" id="w3c1">Jamais<i class="strike" id="k3c1"></i></span></div>
|
||||||
|
<div class="line" style="top:480px;font-size:200px"><span class="w h" id="w3c2">pleine<i class="strike" id="k3c2"></i></span></div>
|
||||||
|
<div id="dusty" class="abs" style="left:142px;top:800px"></div>
|
||||||
|
<div id="dust" class="abs" style="left:0;top:0;width:1080px;height:1920px"></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 6–8 s · Et si… ===== -->
|
||||||
|
<section class="scene" id="s4" style="background:var(--g);color:#fff;clip-path:circle(0% at 50% 50%)">
|
||||||
|
<div class="cam" id="cam4">
|
||||||
|
<div class="line" id="l4a" style="top:800px;font-size:240px"><span class="w h">Et si…</span></div>
|
||||||
|
<div class="line" style="top:560px;font-size:140px"><span class="w h q4">…elle</span> <span class="w h q4">était</span></div>
|
||||||
|
<div class="line" style="top:720px;font-size:140px"><span class="w h q4">dans</span> <span class="w h q4">son</span></div>
|
||||||
|
<div class="line" style="top:890px;font-size:150px;color:var(--y)"><span class="w h q4">téléphone ?</span></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 8–12 s · Le scan ===== -->
|
||||||
|
<section class="scene" id="s5">
|
||||||
|
<div class="cam" id="cam5" style="transform-origin:710px 990px">
|
||||||
|
<div class="line" id="l5a" style="top:250px;font-size:130px"><span class="w h">Au</span> <span class="w h">comptoir</span></div>
|
||||||
|
<div class="line" id="l5b" style="top:240px;font-size:210px"><span class="w h">1</span> <span class="w h" style="color:var(--g)">scan.</span></div>
|
||||||
|
<div class="line" id="l5c" style="top:240px;font-size:190px"><span class="w h">0</span> <span class="w h"><span class="hl">appli.</span></span></div>
|
||||||
|
<!-- présentoir QR de comptoir -->
|
||||||
|
<div class="abs" id="stand" style="left:110px;top:640px;width:520px;height:780px;background:#fff;border-radius:40px;box-shadow:0 30px 70px rgba(0,0,0,.12);overflow:hidden">
|
||||||
|
<div class="abs" style="left:0;top:0;right:0;height:130px;background:var(--g);color:#fff;font-weight:800;font-size:54px;display:flex;align-items:center;justify-content:center;letter-spacing:-.02em">Scannez-moi</div>
|
||||||
|
<div class="abs qr" style="left:60px;top:170px;width:400px;height:400px" data-seed="11"></div>
|
||||||
|
<div class="abs" style="left:0;right:0;top:600px;text-align:center;font-weight:800;font-size:38px;color:var(--brick)">Boulangerie Kerlann</div>
|
||||||
|
<div class="abs" style="left:0;right:0;top:656px;text-align:center;font-weight:600;font-size:30px;color:var(--gr)">Carte de fidélité</div>
|
||||||
|
</div>
|
||||||
|
<div class="abs" id="ring5" style="left:410px;top:690px;width:600px;height:600px;border-radius:50%;border:12px solid var(--y);opacity:0"></div>
|
||||||
|
<!-- iPhone stylisé -->
|
||||||
|
<div class="ph" id="ph5" style="left:520px;top:600px;width:380px;height:780px;border-radius:64px;transform:translate(700px,250px) rotate(40deg)">
|
||||||
|
<div class="scr" style="inset:16px;border-radius:50px">
|
||||||
|
<div class="isl" style="top:22px;width:110px;height:32px;margin-left:-55px"></div>
|
||||||
|
<div class="abs qr" style="left:68px;top:150px;width:212px;height:212px;border-radius:8px;overflow:hidden" data-seed="11"></div>
|
||||||
|
<div class="abs" style="left:44px;top:126px;width:260px;height:260px;border:8px solid var(--y);border-radius:26px;clip-path:polygon(0 0,30% 0,30% 100%,70% 100%,70% 0,100% 0,100% 30%,0 30%,0 70%,100% 70%,100% 100%,0 100%)"></div>
|
||||||
|
<div class="abs" id="beam" style="left:30px;top:120px;width:288px;height:8px;border-radius:4px;background:var(--y);box-shadow:0 0 24px 8px rgba(242,181,68,.7);opacity:0"></div>
|
||||||
|
<div class="abs" style="left:0;right:0;top:470px;text-align:center;color:#fff;font-weight:700;font-size:26px;opacity:.8">Visez le QR code</div>
|
||||||
|
<div class="abs" id="ok5" style="inset:0;background:var(--g);opacity:0;display:flex;align-items:flex-start;justify-content:center;padding-top:150px">
|
||||||
|
<svg viewBox="0 0 100 100" style="width:150px;height:150px"><circle cx="50" cy="50" r="46" fill="#fff"/><path d="M28 52l15 15 30-32" fill="none" stroke="#0E7A66" stroke-width="10" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||||
|
</div>
|
||||||
|
<div class="abs" id="sheet5" style="left:0;right:0;top:320px;bottom:0;background:#fff;border-radius:36px 36px 0 0;transform:translateY(110%)">
|
||||||
|
<div id="k5slot" class="abs" style="left:86px;top:16px;width:176px;height:240px"></div>
|
||||||
|
<div class="abs" id="btn5" style="left:24px;top:266px;width:300px;height:76px;border-radius:38px;background:#000;color:#fff;font-weight:700;font-size:26px;display:flex;align-items:center;justify-content:center">Ajouter à Wallet</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 12–15 s · Dans le Wallet ===== -->
|
||||||
|
<section class="scene" id="s6">
|
||||||
|
<div class="cam" id="cam6" style="transform-origin:490px 800px">
|
||||||
|
<div class="ph" id="ph6" style="left:180px;top:250px;width:620px;height:1260px">
|
||||||
|
<div class="scr" style="background:#F2F2F7">
|
||||||
|
<div class="isl"></div>
|
||||||
|
<div class="abs" style="left:40px;top:100px;font-weight:800;font-size:60px;letter-spacing:-.02em">Wallet</div>
|
||||||
|
<div class="abs" style="right:36px;top:104px;width:62px;height:62px;border-radius:50%;background:#E2E2E8;font-weight:700;font-size:44px;line-height:58px;text-align:center;color:var(--ink)">+</div>
|
||||||
|
<div class="abs" style="left:20px;top:200px;width:536px;height:330px;border-radius:28px;background:#2E4A7D;color:#fff;font-weight:800;font-size:30px;padding:24px 30px">Banque</div>
|
||||||
|
<div class="abs" style="left:20px;top:290px;width:536px;height:330px;border-radius:28px;background:#33332F;color:#fff;font-weight:800;font-size:30px;padding:24px 30px;box-shadow:0 -6px 20px rgba(0,0,0,.15)">Transport</div>
|
||||||
|
<div id="k6slot" class="abs" style="left:20px;top:380px;width:536px;height:338px"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="abs" style="left:100px;top:1120px;transform:rotate(-5deg)"><span class="pill h" id="pa6" style="background:#000;color:#fff">Apple Wallet</span></div>
|
||||||
|
<div class="abs" style="left:300px;top:1270px;transform:rotate(4deg)"><span class="pill h" id="pb6" style="background:#fff;color:var(--ink);box-shadow:0 18px 40px rgba(0,0,0,.18),inset 0 0 0 4px var(--ink)">Google Wallet</span></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 15–20 s · Les tampons ===== -->
|
||||||
|
<section class="scene" id="s7" style="background:var(--g);color:#fff">
|
||||||
|
<div class="cam" id="cam7" style="transform-origin:490px 800px">
|
||||||
|
<div id="k7rot" class="abs" style="left:186px;top:230px;width:608px;height:820px;transform:rotate(-3deg)"><div id="k7slot"></div></div>
|
||||||
|
<div class="line h" id="cnt7" style="top:1090px;height:400px;overflow:hidden">
|
||||||
|
<div id="strip7" class="abs" style="left:0;top:0;width:900px;text-align:center;font-size:390px;line-height:400px"></div>
|
||||||
|
</div>
|
||||||
|
<div class="line" style="top:1150px;font-size:180px;color:var(--y)"><span class="w h" id="w7b">Offerte !</span></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 20–22 s · La notification ===== -->
|
||||||
|
<section class="scene" id="s8" style="background:var(--gl)">
|
||||||
|
<div class="cam" id="cam8" style="transform-origin:490px 820px">
|
||||||
|
<div class="ph" style="left:140px;top:290px;width:700px;height:1800px;border-radius:90px">
|
||||||
|
<div class="scr" style="border-radius:72px;background:linear-gradient(170deg,#13917A,#0A5547 70%)">
|
||||||
|
<div class="isl"></div>
|
||||||
|
<div class="abs" style="left:0;right:0;top:120px;text-align:center;color:#fff;font-weight:600;font-size:190px;letter-spacing:-.03em;line-height:1">08:47</div>
|
||||||
|
<div class="abs" style="left:0;right:0;top:330px;text-align:center;color:#fff;font-weight:600;font-size:40px;opacity:.85">mardi 7 octobre</div>
|
||||||
|
<div class="abs" id="n8" style="left:24px;right:24px;top:420px;background:rgba(255,255,255,.96);border-radius:44px;padding:28px;display:flex;gap:24px;align-items:flex-start;box-shadow:0 20px 50px rgba(0,0,0,.25);transform:translateY(-760px)">
|
||||||
|
<div style="flex:none;width:96px;height:96px;border-radius:24px;background:var(--brick);color:var(--cream);font-weight:800;font-size:38px;display:flex;align-items:center;justify-content:center">BK</div>
|
||||||
|
<div style="flex:1;color:var(--ink)">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:baseline"><b style="font-weight:800;font-size:32px;white-space:nowrap">Boulangerie Kerlann</b><span style="font-size:24px;color:var(--gr);font-weight:600">maintenant</span></div>
|
||||||
|
<div style="font-weight:600;font-size:32px;line-height:1.25;margin-top:6px">Votre viennoiserie offerte vous attend !</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="line" style="top:1110px;font-size:180px;color:#fff"><span class="w h q8">Ils</span></div>
|
||||||
|
<div class="line" style="top:1300px;font-size:140px;color:var(--y)"><span class="w h q8">reviennent.</span></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 22–26 s · Pour le commerçant ===== -->
|
||||||
|
<section class="scene" id="s9" style="background:var(--gl)">
|
||||||
|
<div class="cam" id="cam9">
|
||||||
|
<div class="abs" id="a9" style="inset:0">
|
||||||
|
<svg class="chk" viewBox="0 0 180 180"><circle cx="90" cy="90" r="90" fill="#0E7A66"/><path pathLength="1" d="M50 94l28 28 54-58" fill="none" stroke="#fff" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||||
|
<div class="line" style="top:490px;font-size:150px"><span class="w h">Prête</span> <span class="w h">en</span></div>
|
||||||
|
<div class="line" style="top:660px;font-size:160px;color:var(--g)"><span class="w h">5 minutes</span></div>
|
||||||
|
<div class="abs" style="left:270px;top:900px;width:440px;height:440px">
|
||||||
|
<div class="abs" style="left:190px;top:-36px;width:60px;height:50px;border-radius:12px;background:var(--ink)"></div>
|
||||||
|
<svg class="abs" viewBox="0 0 440 440" style="inset:0"><circle cx="220" cy="220" r="196" fill="#fff" stroke="#0E7A66" stroke-width="30"/><circle id="sw9" cx="220" cy="220" r="150" fill="none" stroke="#F2B544" stroke-width="40" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1" transform="rotate(-90 220 220)"/></svg>
|
||||||
|
<div class="abs" id="hand9" style="left:212px;top:60px;width:16px;height:160px;border-radius:8px;background:var(--ink);transform-origin:50% 100%"></div>
|
||||||
|
<div class="abs" style="left:196px;top:196px;width:48px;height:48px;border-radius:50%;background:var(--ink)"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="abs h" id="b9" style="inset:0">
|
||||||
|
<svg class="chk" viewBox="0 0 180 180"><circle cx="90" cy="90" r="90" fill="#0E7A66"/><path pathLength="1" d="M50 94l28 28 54-58" fill="none" stroke="#fff" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||||
|
<div class="line" style="top:490px;font-size:150px"><span class="w h">À</span> <span class="w h">vos</span></div>
|
||||||
|
<div class="line" style="top:660px;font-size:160px"><span class="w h"><span class="hl">couleurs</span></span></div>
|
||||||
|
<div id="k9rot" class="abs" style="left:298px;top:930px;width:384px;height:520px;transform:rotate(-4deg)"><div id="k9slot"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="abs h" id="c9" style="inset:0">
|
||||||
|
<svg class="chk" viewBox="0 0 180 180"><circle cx="90" cy="90" r="90" fill="#0E7A66"/><path pathLength="1" d="M50 94l28 28 54-58" fill="none" stroke="#fff" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||||
|
<div class="line" style="top:490px;font-size:150px"><span class="w h">Dès</span></div>
|
||||||
|
<div class="line" id="price9" style="top:650px;font-size:260px;display:flex;justify-content:center;align-items:flex-end;opacity:0">
|
||||||
|
<div style="width:330px;height:270px;overflow:hidden;position:relative"><div id="strip9" class="abs" style="left:0;top:0;width:330px;text-align:right;line-height:270px;color:var(--g)"></div></div>
|
||||||
|
<div style="color:var(--g);line-height:270px"> €</div>
|
||||||
|
<div style="font-size:100px;color:var(--gr);padding:0 0 48px 10px">/mois</div>
|
||||||
|
</div>
|
||||||
|
<div class="line" style="top:1010px;font-size:64px"><span class="w h" id="se9"><span class="pill" style="background:var(--g);color:#fff;font-size:64px">sans engagement</span></span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 26–29,5 s · Signature ===== -->
|
||||||
|
<section class="scene" id="s10" style="background:var(--bg);clip-path:circle(0% at 50% 47%)">
|
||||||
|
<div class="cam" id="cam10" style="transform-origin:490px 800px">
|
||||||
|
<div class="abs" id="c10" style="inset:0">
|
||||||
|
<svg id="logo10" class="abs" viewBox="0.5 -2 64 64" overflow="visible" style="left:320px;top:300px;width:340px;height:340px;overflow:visible">
|
||||||
|
<path id="arch1" pathLength="1" d="M12 54V32a9 9 0 0 1 18 0v22" fill="none" stroke="#0E7A66" stroke-width="8" stroke-dasharray="1" stroke-dashoffset="1"/>
|
||||||
|
<path id="arch2" pathLength="1" d="M30 32a9 9 0 0 1 18 0v22" fill="none" stroke="#0E7A66" stroke-width="8" stroke-dasharray="1" stroke-dashoffset="1"/>
|
||||||
|
<circle id="dot10" cx="51" cy="12" r="6" fill="#F2B544" opacity="0"/>
|
||||||
|
</svg>
|
||||||
|
<div class="line" style="top:720px;font-size:124px"><span class="w h" id="nm10">MonEspace<span style="color:var(--g)">Pro</span></span></div>
|
||||||
|
<div class="line" style="top:920px"><span class="w h" id="cta10"><span class="pill" style="background:var(--g);color:#fff;font-size:68px;padding:34px 66px;box-shadow:0 24px 50px rgba(14,122,102,.35)">Créez votre carte</span></span></div>
|
||||||
|
<div class="line" style="top:1150px;font-size:76px;font-weight:700"><span class="w h" id="url10">monespacepro<span style="color:var(--g)">.eu</span></span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== 0–3 s (et 29,5–30 s, raccord de boucle) · Accroche ===== -->
|
||||||
|
<section class="scene" id="s1">
|
||||||
|
<div class="cam" id="cam1">
|
||||||
|
<div class="line" style="top:250px;font-size:300px"><span class="w" id="stopw" style="padding:0 .08em;border-radius:.1em">STOP</span></div>
|
||||||
|
<div id="ballgrp" class="abs" style="inset:0">
|
||||||
|
<div id="hand" class="abs">
|
||||||
|
<div class="sleeve"></div><div class="palm"></div>
|
||||||
|
<div class="fing" style="left:28px;top:40px"></div><div class="fing" style="left:92px;top:0"></div>
|
||||||
|
<div class="fing" style="left:156px;top:10px"></div><div class="fing" style="left:220px;top:50px"></div>
|
||||||
|
<div class="thumb"></div>
|
||||||
|
</div>
|
||||||
|
<div id="c1slot" class="cbox" style="left:80px;top:700px"></div>
|
||||||
|
<div id="stamp" class="abs"><div class="knob"></div><div class="neck"></div><div class="body"></div><div class="rub"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="line" style="top:300px;font-size:130px"><span class="w h q2">Fini</span> <span class="w h q2">la</span> <span class="w h q2">carte</span></div>
|
||||||
|
<div class="line" style="top:760px;font-size:130px"><span class="w h" id="en2">en</span></div>
|
||||||
|
<div class="line" style="top:900px;font-size:190px"><span class="w h" id="cartonw"><span class="hl">CARTON.</span></span></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div id="fx"></div>
|
||||||
|
</div>
|
||||||
|
<div id="flash"></div>
|
||||||
|
<div id="clock"></div>
|
||||||
|
</div>
|
||||||
|
<button id="replay" type="button">↻ Rejouer</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
const $=s=>typeof s==='string'?document.querySelector(s):s;
|
||||||
|
const $$=(s,r=document)=>[...r.querySelectorAll(s)];
|
||||||
|
|
||||||
|
/* ---------- Générateurs ---------- */
|
||||||
|
function mulberry(a){return function(){a|=0;a=a+0x6D2B79F5|0;let t=Math.imul(a^a>>>15,1|a);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296}}
|
||||||
|
function qrSVG(seed){
|
||||||
|
const n=25,r=mulberry(seed);let d='';
|
||||||
|
const fin=(x,y)=>{d+=`M${x} ${y}h7v7h-7zM${x+1} ${y+1}h5v5h-5zM${x+2} ${y+2}h3v3h-3z`};
|
||||||
|
fin(0,0);fin(n-7,0);fin(0,n-7);
|
||||||
|
for(let y=0;y<n;y++)for(let x=0;x<n;x++){
|
||||||
|
if((x<8&&y<8)||(x>n-9&&y<8)||(x<8&&y>n-9))continue;
|
||||||
|
if(r()<.48)d+=`M${x} ${y}h1v1h-1z`;
|
||||||
|
}
|
||||||
|
return `<svg viewBox="-1 -1 27 27" shape-rendering="crispEdges" style="width:100%;height:100%;display:block"><rect x="-1" y="-1" width="27" height="27" fill="#fff"/><path d="${d}" fill="#1C1C19" fill-rule="evenodd"/></svg>`;
|
||||||
|
}
|
||||||
|
const STAR='<svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.6 7.1.6-5.4 4.7 1.6 7-6.2-3.7-6.2 3.7 1.6-7L2 9.2l7.1-.6z" fill="#8C2F39"/></svg>';
|
||||||
|
const TICK='<svg viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5" fill="none" stroke="#A64B17" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
||||||
|
|
||||||
|
function carton(filled,foldBg,extra=''){
|
||||||
|
const slots=Array.from({length:10},(_,i)=>`<div class="slot">${i<filled?`<div class="ink">${STAR}</div>`:''}${extra&&i===filled?extra:''}</div>`).join('');
|
||||||
|
return `<div class="carton" ${foldBg==='var(--bg)'?'id="carton"':''}><div class="cfold" style="background:linear-gradient(225deg,${foldBg} 50%,#C9B385 50%)"></div><div class="ct">CARTE DE FIDÉLITÉ</div><div class="cs">10 tampons = 1 viennoiserie</div><div class="slots">${slots}</div>
|
||||||
|
<svg class="crease" ${foldBg==='var(--bg)'?'id="crease"':''} viewBox="0 0 820 520"><g fill="none" stroke="rgba(90,60,20,.45)" stroke-width="6" stroke-linecap="round"><path d="M0 120L260 260 420 90 610 300 820 180"/><path d="M90 520L300 300 520 430 700 260"/><path d="M200 0L300 300M560 0L520 430M820 420L610 300"/></g></svg></div>`;
|
||||||
|
}
|
||||||
|
/* Carte réelle de l'application : mêmes champs et même texte de récompense que l'API (backend/src/wallet). */
|
||||||
|
const PASS={store:'Boulangerie Kerlann',program:'Carte fidélité',member:'Camille',bg:'#A64B17',fg:'#FFF4E4',label:'#F7D58B',reward:'Viennoiserie offerte',cost:10};
|
||||||
|
const nextTxt=n=>n>=PASS.cost?`${PASS.reward} : disponible !`:`${PASS.reward} : encore ${PASS.cost-n} tampon${PASS.cost-n>1?'s':''}`;
|
||||||
|
const roll=vals=>`<span class="rw"><span class="rs">${vals.map(v=>`<span>${v}</span>`).join('')}</span></span>`;
|
||||||
|
function fakeQr(){
|
||||||
|
let d='';const finder=(x,y)=>{d+=`M${x} ${y}h7v7h-7zM${x+1} ${y+1}v5h5v-5zM${x+2} ${y+2}h3v3h-3z`};
|
||||||
|
finder(0,0);finder(14,0);finder(0,14);
|
||||||
|
for(let y=0;y<21;y++)for(let x=0;x<21;x++){const f=(x<8&&y<8)||(x>12&&y<8)||(x<8&&y>12);if(!f&&(x*7+y*13+x*y)%3===0)d+=`M${x} ${y}h1v1h-1z`}
|
||||||
|
return `<svg viewBox="0 0 21 21" shape-rendering="crispEdges"><rect width="21" height="21" fill="#fff"/><path d="${d}" fill="#000" fill-rule="evenodd"/></svg>`;
|
||||||
|
}
|
||||||
|
/** from : solde de départ d'une carte dont le solde défile jusqu'à la récompense (scène des tampons). */
|
||||||
|
function pass(id,scale,balance,from){
|
||||||
|
const vals=from!=null?Array.from({length:PASS.cost-from+1},(_,i)=>from+i):null;
|
||||||
|
const bal=vals?roll(vals):balance,nxt=vals?roll(vals.map(nextTxt)):nextTxt(balance),lb=`style="color:${PASS.label}"`;
|
||||||
|
return `<div class="pbox" id="${id}"><div class="wa" style="background:${PASS.bg};color:${PASS.fg};transform:scale(${scale})">
|
||||||
|
<div class="wa-h"><b>${PASS.store}</b><div class="wa-r"><small ${lb}>TAMPONS</small><span>${bal}</span></div></div>
|
||||||
|
<div class="wa-s"><small ${lb}>SOLDE</small><span>${bal}</span></div>
|
||||||
|
<div class="wa-2"><div><small ${lb}>PROGRAMME</small><span>${PASS.program}</span></div><div class="wa-r"><small ${lb}>MEMBRE</small><span>${PASS.member}</span></div></div>
|
||||||
|
<div class="wa-n"><small ${lb}>PROCHAINE RÉCOMPENSE</small><span>${nxt}</span></div>
|
||||||
|
<div class="wa-q"><i>${fakeQr()}</i></div></div></div>`;
|
||||||
|
}
|
||||||
|
function miniCarton(){
|
||||||
|
return `<div style="width:200px;height:126px;border-radius:14px;background:linear-gradient(160deg,#EEDDB6,#E0C998);box-shadow:0 10px 20px rgba(60,40,10,.2);padding:18px 16px;display:grid;grid-template-columns:repeat(5,1fr);gap:8px;align-content:end">${'<i style="display:block;aspect-ratio:1;border-radius:50%;border:3px dashed rgba(107,74,43,.5)"></i>'.repeat(10)}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Construction statique de la scène */
|
||||||
|
$('#c1slot').innerHTML=carton(3,'var(--bg)',`<div class="ink" id="ink4" style="opacity:0">${STAR}</div>`);
|
||||||
|
$('#dusty').innerHTML=`<div style="transform:scale(.85);transform-origin:0 0;filter:saturate(.55) brightness(.8)">${carton(3,'#2A2A26')}</div>
|
||||||
|
<div class="abs" style="left:0;top:0;width:697px;height:442px;border-radius:24px;background:radial-gradient(ellipse at 40% 30%,rgba(210,205,190,.35),rgba(120,115,100,.5))"></div>
|
||||||
|
<svg class="abs" viewBox="0 0 200 200" style="left:-10px;top:-10px;width:220px;height:220px"><g fill="none" stroke="rgba(255,255,255,.55)" stroke-width="2"><path d="M0 0L200 60M0 0L140 140M0 0L60 200"/><path d="M60 18Q50 40 42 42Q30 50 18 60"/><path d="M120 36Q100 70 84 84Q60 100 36 120"/><path d="M175 52Q140 100 126 126Q90 150 52 175"/></g></svg>`;
|
||||||
|
$$('.mini').forEach(m=>m.innerHTML=miniCarton());
|
||||||
|
$$('.qr').forEach(q=>q.innerHTML=qrSVG(+q.dataset.seed));
|
||||||
|
$('#k5slot').innerHTML=pass('k5',.55,0);
|
||||||
|
$('#k6slot').innerHTML=pass('k6',1.675,0);
|
||||||
|
$('#k6').style.transform='translateY(1000px)';
|
||||||
|
$('#k7slot').innerHTML=pass('k7',1.9,null,3);
|
||||||
|
$('#k9slot').innerHTML=pass('k9',1.2,7);
|
||||||
|
$('#strip7').innerHTML=[3,4,5,6,7,8,9,10].map(n=>`<div style="height:400px;line-height:400px;overflow:hidden;white-space:nowrap">${n}<span style="font-size:150px;line-height:0;color:var(--gl);opacity:.75">/10</span></div>`).join('');
|
||||||
|
$('#strip9').innerHTML=Array.from({length:20},(_,n)=>`<div>${n}</div>`).join('');
|
||||||
|
{ // poussière (5–6 s)
|
||||||
|
const r=mulberry(42);let h='';
|
||||||
|
for(let i=0;i<34;i++){const s=4+r()*10;h+=`<i class="abs dp" style="left:${130+r()*720}px;top:${780+r()*520}px;width:${s}px;height:${s}px;border-radius:50%;background:rgba(220,215,200,${.35+r()*.4})"></i>`}
|
||||||
|
$('#dust').innerHTML=h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Moteur de timeline (Web Animations API) ---------- */
|
||||||
|
let A=[],FX=[],rnd=mulberry(1);
|
||||||
|
const OUT='cubic-bezier(.2,.8,.2,1)',IN='cubic-bezier(.6,0,.9,.4)',IO='cubic-bezier(.65,0,.35,1)',BACK='cubic-bezier(.3,1.55,.5,1)',LIN='linear';
|
||||||
|
function an(el,t,d,kf,o={}){
|
||||||
|
const a=$(el).animate(kf,{delay:t*1000,duration:Math.max(1,d*1000),fill:o.fill||'forwards',easing:o.ease||OUT,iterations:o.it||1,direction:o.dir||'normal'});
|
||||||
|
A.push(a);return a;
|
||||||
|
}
|
||||||
|
/* visibilité d'une scène entre t0 et t1 */
|
||||||
|
function vis(el,t0,t1){
|
||||||
|
an(el,t0,.001,[{visibility:'visible'},{visibility:'visible'}],{ease:LIN});
|
||||||
|
if(t1!=null)an(el,t1,.001,[{visibility:'hidden'},{visibility:'hidden'}],{ease:LIN});
|
||||||
|
}
|
||||||
|
const set=(el,t,props)=>an(el,t,.001,[props,props],{ease:LIN});
|
||||||
|
/* mot qui claque : 140 % → 100 % avec léger dépassement */
|
||||||
|
function slam(el,t,s=1.4,d=.18){return an(el,t,d,[{opacity:0,transform:`scale(${s})`},{opacity:1,transform:'scale(.96)',offset:.66},{opacity:1,transform:'scale(1)'}],{ease:LIN})}
|
||||||
|
function words(list,t,step=.125,s=1.4){$$(list).forEach((w,i)=>slam(w,t+i*step,s))}
|
||||||
|
function out(el,t,d=.12,tf='scale(.85)'){return an(el,t,d,[{opacity:1},{opacity:0,transform:tf}],{ease:IN})}
|
||||||
|
const camTo=(el,t,d,tf,ease=OUT)=>an(el,t,d,[{transform:tf}],{ease});
|
||||||
|
function shake(t,a=6,d=.15){
|
||||||
|
an('#shake',t,d,[{transform:'none'},{transform:`translate(${a}px,${-a*.6}px)`},{transform:`translate(${-a}px,${a*.5}px)`},{transform:`translate(${a*.6}px,${a}px)`},{transform:`translate(${-a*.4}px,${-a*.4}px)`},{transform:'none'}],{fill:'none',ease:LIN});
|
||||||
|
}
|
||||||
|
function flash(t){an('#flash',t,.16,[{opacity:1},{opacity:0}],{fill:'none',ease:'ease-out'})}
|
||||||
|
function strike(el,t){an(el,t,.18,[{transform:'rotate(-5deg) scaleX(1)'}],{ease:OUT})}
|
||||||
|
function draw(el,t,d=.3){an(el,t,d,[{strokeDashoffset:1},{strokeDashoffset:0}],{ease:OUT})}
|
||||||
|
function fx(cls,x,y){const e=document.createElement('i');e.className=cls;e.style.left=x+'px';e.style.top=y+'px';$('#fx').appendChild(e);FX.push(e);return e}
|
||||||
|
/* éclats graphiques : traits + points jaunes (le point du logo) */
|
||||||
|
function sparks(x,y,t,o={}){
|
||||||
|
const n=o.n||10,r0=o.r0||60,r1=o.r1||170;
|
||||||
|
for(let i=0;i<n;i++){
|
||||||
|
const a=i*360/n+(rnd()*16-8),dot=i%3===1,e=fx('sp'+(dot?' dotsp':''),x,y);
|
||||||
|
if(!dot&&o.c)e.style.background=o.c;
|
||||||
|
const R1=dot?r1*1.25:r1;
|
||||||
|
an(e,t,dot?.45:.34,[{opacity:1,transform:`rotate(${a}deg) translateY(${-r0}px) scaleY(1)`},{opacity:0,transform:`rotate(${a}deg) translateY(${-R1}px) scaleY(${dot?1:.25})`}],{ease:OUT});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function confetti(x,y,t,n=80){
|
||||||
|
const cols=['#F2B544','#0E7A66','#FFFFFF','#F7D58B','#7FD3BF'];
|
||||||
|
for(let i=0;i<n;i++){
|
||||||
|
const e=fx('cf',x,y),w=14+rnd()*22,h=9+rnd()*10;
|
||||||
|
e.style.width=w+'px';e.style.height=h+'px';e.style.background=cols[i%cols.length];
|
||||||
|
const vx=(rnd()-.5)*1700,vy=-(600+rnd()*1100),g=2300,rot=rnd()*900-450,D=1.7,kf=[];
|
||||||
|
for(let k=0;k<=8;k++){const s=k/8*D;kf.push({opacity:k<7?1:0,transform:`translate(${vx*s}px,${vy*s+.5*g*s*s}px) rotate(${rot*k/8}deg)`})}
|
||||||
|
an(e,t,D,kf,{ease:LIN});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* centre d'un élément dans le repère du calque d'effets (même repère que les caméras) */
|
||||||
|
function pt(el){const s=$('#fx').getBoundingClientRect(),k=s.width/1080,r=$(el).getBoundingClientRect();return[(r.left+r.width/2-s.left)/k,(r.top+r.height/2-s.top)/k]}
|
||||||
|
|
||||||
|
/* ---------- TIMELINE — temps forts sur une grille de 0,5 s (120 BPM) ---------- */
|
||||||
|
let master;
|
||||||
|
function build(){
|
||||||
|
A.forEach(a=>a.cancel());A=[];FX.forEach(e=>e.remove());FX=[];rnd=mulberry(1);
|
||||||
|
$('#replay').classList.remove('on');
|
||||||
|
master=an('#clock',0,30,[{opacity:0},{opacity:0}],{ease:LIN});
|
||||||
|
master.finished.then(()=>$('#replay').classList.add('on')).catch(()=>{});
|
||||||
|
const sol7=pt('#k7 .wa-s'),dot10=pt('#dot10');
|
||||||
|
|
||||||
|
/* ♪ 0,0 — ACCROCHE : la scène est déjà en mouvement, « STOP » en train de tomber */
|
||||||
|
vis('#s1',0,3);
|
||||||
|
an('#stopw',0,.22,[{opacity:1,transform:'translateY(-140px) scale(1.35)'},{opacity:1,transform:'translateY(14px) scale(.97)',offset:.7},{opacity:1,transform:'none'}],{ease:LIN});
|
||||||
|
camTo('#cam1',0,.5,'scale(1.05)',LIN);
|
||||||
|
an('#stamp',.22,.28,[{transform:'translateY(-1300px)'},{transform:'translateY(0)'}],{ease:IN});
|
||||||
|
/* ♪ 0,5 — IMPACT du tampon */
|
||||||
|
an('#stamp',.5,.14,[{transform:'scaleY(.88)'},{transform:'scaleY(1)'}],{ease:OUT});
|
||||||
|
an('#ink4',.5,.12,[{opacity:0,transform:'rotate(-14deg) scale(1.5)'},{opacity:.9,transform:'rotate(-14deg) scale(1)'}],{ease:OUT});
|
||||||
|
shake(.5,12);sparks(625,960,.5);
|
||||||
|
camTo('#cam1',.5,.08,'scale(1.15) rotate(-1deg)');camTo('#cam1',.58,.42,'scale(1.08) rotate(1deg)');
|
||||||
|
an('#stamp',.68,.25,[{transform:'translateY(-1300px)'}],{ease:IN});
|
||||||
|
/* ♪ 1,0 — STOP surligné jaune */
|
||||||
|
an('#stopw',1,.08,[{backgroundColor:'rgba(242,181,68,0)'},{backgroundColor:'#F2B544'}],{ease:LIN});
|
||||||
|
an('#stopw',1,.12,[{transform:'scale(1.12) rotate(-3deg)'},{transform:'rotate(-2deg)'}],{ease:OUT});
|
||||||
|
camTo('#cam1',1,.45,'scale(1.1) rotate(-2deg)',IO);
|
||||||
|
/* ♪ 1,5 — LA CARTE EST ÉCRASÉE · « Fini la carte » */
|
||||||
|
out('#stopw',1.42,.12,'translateY(-500px) rotate(-6deg)');
|
||||||
|
camTo('#cam1',1.5,.1,'none');
|
||||||
|
words('.q2',1.5);
|
||||||
|
an('#hand',1.5,.2,[{transform:'translateY(0)'}],{ease:OUT});
|
||||||
|
an('#carton',1.6,.25,[{transform:'rotate(-4deg) scale(1)',borderRadius:'28px'},{transform:'rotate(150deg) scale(.3,.47)',borderRadius:'50%'}],{ease:IO});
|
||||||
|
an('#crease',1.6,.2,[{opacity:0},{opacity:1}]);
|
||||||
|
$$('#hand .fing').forEach((f,i)=>an(f,1.75,.1,[{transform:`scaleY(.55) rotate(${(i-1.5)*-9}deg)`}]));
|
||||||
|
shake(1.85,6);
|
||||||
|
/* 1,9 — WHIP PAN : la boule part hors champ */
|
||||||
|
an('#ballgrp',1.9,.15,[{transform:'none',filter:'blur(0px)'},{transform:'translateX(-1500px)',filter:'blur(26px)'}],{ease:IN});
|
||||||
|
camTo('#cam1',1.9,.15,'translateX(-50px) rotate(-2deg)',IN);camTo('#cam1',2.05,.2,'none');
|
||||||
|
/* ♪ 2,25 / 2,5 — « en CARTON. » */
|
||||||
|
slam('#en2',2.25);
|
||||||
|
slam('#cartonw',2.5,1.7);shake(2.5,10);sparks(490,995,2.5,{c:'#F2B544',r0:220,r1:360,n:12});
|
||||||
|
camTo('#cam1',2.5,.08,'scale(1.12)');camTo('#cam1',2.58,.42,'scale(1.05) rotate(1.5deg)');
|
||||||
|
an('#cartonw .hl',2.62,.07,[{transform:'rotate(-2.5deg) translateX(-4px)'},{transform:'rotate(2.5deg) translateX(4px)'}],{fill:'none',it:5,dir:'alternate',ease:LIN});
|
||||||
|
|
||||||
|
/* ♪ 3,0 — SLAM : « Oubliée » (canapé) */
|
||||||
|
vis('#s3a',3,4);
|
||||||
|
an('#s3a',3,.16,[{transform:'scale(1.35)'},{transform:'none'}]);shake(3,8);
|
||||||
|
slam('#w3a',3);
|
||||||
|
an('#mc3a',3.05,.45,[{transform:'translateX(-600px) rotate(-30deg)'},{transform:'translateX(0) rotate(6deg)'}]);
|
||||||
|
/* ♪ 3,5 — trait rouge */
|
||||||
|
strike('#k3a',3.5);shake(3.5,4);
|
||||||
|
camTo('#cam3a',3.5,.5,'scale(1.08) rotate(-1.5deg)');
|
||||||
|
|
||||||
|
/* ♪ 4,0 — COUPE SÈCHE + punch-in : « Perdue » (fenêtre) */
|
||||||
|
vis('#s3b',4,5.15);
|
||||||
|
an('#cam3b',4,.14,[{transform:'scale(1.2)'},{transform:'none'}]);
|
||||||
|
slam('#w3b',4);
|
||||||
|
an('#mc3b',4.08,.75,[{transform:'none',opacity:1},{transform:'translate(10px,-263px) rotate(400deg) scale(.45)',opacity:1,offset:.6},{transform:'translate(220px,-520px) rotate(620deg) scale(.08)',opacity:0}],{ease:'cubic-bezier(.3,.5,.4,1)'});
|
||||||
|
/* ♪ 4,5 */
|
||||||
|
strike('#k3b',4.5);shake(4.5,4);
|
||||||
|
camTo('#cam3b',4.5,.5,'scale(1.06) rotate(2deg)');
|
||||||
|
/* ♪ 5,0 — WHIP vertical : « Jamais pleine » (poussière) */
|
||||||
|
an('#s3b',5,.15,[{transform:'none',filter:'blur(0px)'},{transform:'translateY(-1920px)',filter:'blur(30px)'}],{ease:IN});
|
||||||
|
vis('#s3c',5,6.1);
|
||||||
|
an('#s3c',5,.15,[{transform:'translateY(1920px)',filter:'blur(30px)'},{transform:'none',filter:'blur(0px)'}],{ease:OUT});
|
||||||
|
slam('#w3c1',5.1);slam('#w3c2',5.22);
|
||||||
|
camTo('#cam3c',5,1.1,'scale(1.1) rotate(1deg)',LIN);
|
||||||
|
$$('#dust .dp').forEach((d,i)=>an(d,5,1.1,[{transform:'none'},{transform:`translate(${(i%5-2)*12}px,${-50-(i%7)*12}px)`}],{ease:LIN}));
|
||||||
|
/* ♪ 5,5 */
|
||||||
|
strike('#k3c1',5.5);strike('#k3c2',5.62);shake(5.5,5);
|
||||||
|
|
||||||
|
/* ♪ 6,0 — RUPTURE : flash blanc + masque circulaire vert */
|
||||||
|
flash(6);
|
||||||
|
vis('#s4',6,8.15);
|
||||||
|
an('#s4',6,.3,[{clipPath:'circle(0% at 50% 50%)'},{clipPath:'circle(80% at 50% 50%)'}]);
|
||||||
|
camTo('#cam4',6,1,'scale(1.05) rotate(-2deg)',LIN);
|
||||||
|
slam('#l4a .w',6.25,1.6);shake(6.25,6);
|
||||||
|
out('#l4a .w',6.92,.1,'scale(.6) translateY(-80px)');
|
||||||
|
/* ♪ 7,0 — mot par mot */
|
||||||
|
camTo('#cam4',7,.1,'rotate(1.5deg)');
|
||||||
|
words('.q4',7,.125,1.5);
|
||||||
|
/* ♪ 7,5 — « téléphone ? » punch-in */
|
||||||
|
shake(7.5,6);sparks(490,965,7.5,{c:'#fff',r0:300,r1:420,n:12});
|
||||||
|
camTo('#cam4',7.5,.1,'scale(1.12) rotate(-1deg)');camTo('#cam4',7.6,.4,'scale(1.06)');
|
||||||
|
|
||||||
|
/* ♪ 8,0 — SLAM du comptoir + punch-in sur le QR */
|
||||||
|
vis('#s5',8,12.3);
|
||||||
|
an('#s5',8,.16,[{transform:'scale(.7) rotate(-3deg)'},{transform:'none'}],{ease:BACK});
|
||||||
|
words('#l5a .w',8,.125);
|
||||||
|
camTo('#cam5',8.1,.12,'scale(1.15)');
|
||||||
|
/* ♪ 8,5 — le téléphone arrive en rotation */
|
||||||
|
camTo('#cam5',8.5,.3,'none',IO);
|
||||||
|
an('#ph5',8.5,.45,[{transform:'translate(700px,250px) rotate(40deg)'},{transform:'translate(-24px,-10px) rotate(-10deg)',offset:.75},{transform:'rotate(-6deg)'}],{ease:OUT});
|
||||||
|
/* ♪ 9,0 — posé, faisceau de scan */
|
||||||
|
shake(9,5);
|
||||||
|
an('#beam',9,.48,[{opacity:1,top:'120px'},{opacity:1,top:'390px'}],{ease:IO});
|
||||||
|
camTo('#cam5',9,.5,'scale(1.06) rotate(1deg)',LIN);
|
||||||
|
/* ♪ 9,5 — BIP : « 1 scan. » */
|
||||||
|
out('#beam',9.48,.05,'none');
|
||||||
|
out('#l5a',9.42,.08,'translateY(-120px)');
|
||||||
|
words('#l5b .w',9.5,.125,1.5);
|
||||||
|
an('#ok5',9.5,.14,[{opacity:0,transform:'scale(.6)'},{opacity:1,transform:'none'}],{ease:BACK});
|
||||||
|
an('#ring5',9.5,.5,[{opacity:1,transform:'scale(.7)'},{opacity:0,transform:'scale(1.7)'}]);
|
||||||
|
sparks(710,990,9.5,{r0:280,r1:420,n:14});
|
||||||
|
camTo('#cam5',9.5,.08,'scale(1.12) rotate(-1deg)');camTo('#cam5',9.58,.42,'scale(1.05)');
|
||||||
|
/* ♪ 10,0 — la carte s'affiche dans le téléphone */
|
||||||
|
an('#sheet5',10,.28,[{transform:'translateY(110%)'},{transform:'none'}],{ease:BACK});
|
||||||
|
/* ♪ 10,5 — « 0 appli. » */
|
||||||
|
out('#l5b',10.42,.1,'translateX(-700px)');
|
||||||
|
words('#l5c .w',10.5,.125,1.6);shake(10.5,5);
|
||||||
|
camTo('#cam5',10.5,.5,'scale(1.08) rotate(2deg)');
|
||||||
|
an('#btn5',10.75,.22,[{transform:'none'},{transform:'scale(.88)',offset:.4},{transform:'none'}],{fill:'none'});
|
||||||
|
/* ♪ 11,0 / 11,5 — recadrages */
|
||||||
|
camTo('#cam5',11,.1,'scale(1.16) rotate(1deg)');
|
||||||
|
camTo('#cam5',11.5,.4,'scale(1.1) rotate(-2deg)',IO);
|
||||||
|
/* ♪ 12,0 — ZOOM À TRAVERS l'écran du téléphone */
|
||||||
|
camTo('#cam5',12,.3,'scale(4) rotate(-6deg)',IN);
|
||||||
|
|
||||||
|
vis('#s6',12.15,15.25);
|
||||||
|
an('#s6',12.15,.25,[{transform:'scale(.5)',opacity:0},{transform:'none',opacity:1}]);
|
||||||
|
/* ♪ 12,5 → 13,0 — la carte glisse et se range dans le Wallet */
|
||||||
|
an('#k6',12.5,.5,[{transform:'translateY(1000px)'},{transform:'translateY(-40px)',offset:.7},{transform:'translateY(8px)',offset:.88},{transform:'none'}],{ease:LIN});
|
||||||
|
/* ♪ 13,0 — rebond */
|
||||||
|
shake(13,6);sparks(490,630,13,{r0:300,r1:430,n:12});
|
||||||
|
camTo('#cam6',13,.1,'scale(1.06)');
|
||||||
|
/* ♪ 13,5 / 14,0 — pastilles */
|
||||||
|
slam('#pa6',13.5,1.6);camTo('#cam6',13.5,.3,'scale(1.06) rotate(-1.5deg)');
|
||||||
|
slam('#pb6',14,1.6);camTo('#cam6',14,.3,'scale(1.06) rotate(1.5deg)');
|
||||||
|
/* ♪ 14,5 — punch-in sur la carte */
|
||||||
|
camTo('#cam6',14.5,.1,'scale(1.15) rotate(0deg)');camTo('#cam6',14.6,.4,'scale(1.1)');
|
||||||
|
|
||||||
|
/* ♪ 15,0 — VOLET DIAGONAL vert : gros plan sur la carte */
|
||||||
|
vis('#s7',15,20.15);
|
||||||
|
an('#s7',15,.25,[{clipPath:'polygon(0 0,0 0,0 0)'},{clipPath:'polygon(0 0,250% 0,0 250%)'}],{ease:IO});
|
||||||
|
an('#k7rot',15,.3,[{transform:'translateY(-200px) rotate(-14deg) scale(1.25)'},{transform:'rotate(-3deg)'}],{ease:BACK});
|
||||||
|
an('#cnt7',15.15,.2,[{opacity:0,transform:'translateY(120px)'},{opacity:1,transform:'none'}],{ease:BACK});
|
||||||
|
/* tampons qui accélèrent : ♪ 15,5 · 16,25 · 16,75 · 17,25 · 17,5 · 17,75 · ♪ 18,0 */
|
||||||
|
const rolls7=$$('#k7 .rs');
|
||||||
|
[15.5,16.25,16.75,17.25,17.5,17.75,18].forEach((t,j)=>{
|
||||||
|
const k=4+j;
|
||||||
|
rolls7.forEach(r=>an(r,t,.16,[{transform:`translateY(${-(k-3)*1.25}em)`}],{ease:BACK}));
|
||||||
|
an('#k7 .wa-s',t,.22,[{backgroundColor:'rgba(255,255,255,.34)'},{backgroundColor:'rgba(255,255,255,.08)'}],{fill:'none',ease:OUT});
|
||||||
|
an('#strip7',t,.16,[{transform:`translateY(${-(k-3)*400}px)`}],{ease:BACK});
|
||||||
|
shake(t,4+j);sparks(sol7[0]-150,sol7[1]+40,t,{c:'#fff',r0:60,r1:150,n:8});
|
||||||
|
camTo('#cam7',t,.08,`scale(${1.02+j*.015}) rotate(${j%2?-1.5:1.5}deg)`);
|
||||||
|
});
|
||||||
|
/* ♪ 18,0 — 10/10 : confettis + zoom brusque */
|
||||||
|
confetti(490,640,18);confetti(490,1250,18.06,50);
|
||||||
|
camTo('#cam7',18.08,.1,'scale(1.24) rotate(0deg)');camTo('#cam7',18.18,.8,'scale(1.06)');
|
||||||
|
an('#k7 .wa-n',18,.12,[{backgroundColor:'rgba(242,181,68,0)',color:'#FFF4E4'},{backgroundColor:'#F2B544',color:'#1C1C19'}]);
|
||||||
|
/* ♪ 18,5 — « Offerte ! » */
|
||||||
|
out('#cnt7',18.42,.1,'scale(.5)');
|
||||||
|
slam('#w7b',18.5,1.7);shake(18.5,8);
|
||||||
|
/* ♪ 19,0 / 19,5 */
|
||||||
|
an('#k7rot',19,.3,[{transform:'rotate(2deg) scale(1.03)'}],{ease:BACK});
|
||||||
|
an('#w7b',19.5,.25,[{transform:'none'},{transform:'scale(1.1) rotate(-2deg)'},{transform:'none'}],{fill:'none',ease:IO});
|
||||||
|
/* ♪ 20,0 — WHIP PAN horizontal */
|
||||||
|
an('#s7',20,.15,[{transform:'none',filter:'blur(0px)'},{transform:'translateX(-1080px)',filter:'blur(30px)'}],{ease:IN});
|
||||||
|
|
||||||
|
vis('#s8',20,22.1);
|
||||||
|
an('#s8',20,.15,[{transform:'translateX(1080px)',filter:'blur(30px)'},{transform:'none',filter:'blur(0px)'}]);
|
||||||
|
/* ♪ 20,5 — la notification glisse en haut de l'écran */
|
||||||
|
an('#n8',20.5,.42,[{transform:'translateY(-760px)'},{transform:'translateY(30px)',offset:.68},{transform:'translateY(-8px)',offset:.85},{transform:'none'}],{ease:LIN});
|
||||||
|
camTo('#cam8',20.5,.5,'scale(1.06)');
|
||||||
|
shake(20.75,4);
|
||||||
|
/* ♪ 21,0 — « Ils reviennent. » */
|
||||||
|
words('.q8',21,.125,1.5);
|
||||||
|
camTo('#cam8',21,.08,'scale(1.12) rotate(-1.5deg)');camTo('#cam8',21.08,.42,'scale(1.08)');
|
||||||
|
/* ♪ 21,5 */
|
||||||
|
camTo('#cam8',21.5,.5,'scale(1.1) rotate(1.5deg)');
|
||||||
|
|
||||||
|
/* ♪ 22,0 — FLASH + fond clair : argument 1, glisse */
|
||||||
|
flash(22);
|
||||||
|
vis('#s9',22,26.3);
|
||||||
|
an('#a9',22,.2,[{transform:'translateX(-1100px) rotate(-6deg)'},{transform:'none'}]);
|
||||||
|
slam('#a9 .chk',22.05,1.5);draw('#a9 .chk path',22.15);
|
||||||
|
words('#a9 .w',22.1,.125);
|
||||||
|
an('#hand9',22.2,1,[{transform:'none'},{transform:'rotate(330deg)'}],{ease:'cubic-bezier(.3,0,.2,1)'});
|
||||||
|
draw('#sw9',22.2,1);
|
||||||
|
/* ♪ 22,5 */
|
||||||
|
camTo('#cam9',22.5,.1,'scale(1.06) rotate(-1deg)');camTo('#cam9',22.6,.4,'scale(1.03)');
|
||||||
|
/* ♪ 23,25 — argument 2, zoom : « À vos couleurs » */
|
||||||
|
set('#a9',23.25,{opacity:0});
|
||||||
|
an('#b9',23.25,.2,[{transform:'scale(.2)',opacity:0},{transform:'none',opacity:1}],{ease:BACK});
|
||||||
|
camTo('#cam9',23.25,.1,'none');
|
||||||
|
slam('#b9 .chk',23.3,1.5);draw('#b9 .chk path',23.4);
|
||||||
|
words('#b9 .w',23.3,.125);
|
||||||
|
/* ♪ 23,75 · 24,0 · 24,25 — la carte change de couleur : vert, marine, brique */
|
||||||
|
[['#0E7A66',23.75,-2],['#1F3A68',24,3],['#A64B17',24.25,-4]].forEach(([c,t,r])=>{
|
||||||
|
an('#k9 .wa',t,.06,[{backgroundColor:c}],{ease:LIN});
|
||||||
|
an('#k9rot',t,.14,[{transform:`rotate(${r}deg) scale(1.08)`},{transform:`rotate(${r}deg)`}]);
|
||||||
|
shake(t,3);
|
||||||
|
});
|
||||||
|
/* ♪ 24,5 — argument 3, rotation : « Dès 19 €/mois » */
|
||||||
|
set('#b9',24.5,{opacity:0});
|
||||||
|
an('#c9',24.5,.25,[{transform:'rotate(-30deg) scale(.4)',opacity:0},{transform:'none',opacity:1}],{ease:BACK});
|
||||||
|
slam('#c9 .chk',24.55,1.5);draw('#c9 .chk path',24.65);
|
||||||
|
words('#c9 .line:nth-of-type(1) .w',24.55);
|
||||||
|
slam('#price9',24.62,1.3);
|
||||||
|
an('#strip9',24.65,.6,[{transform:'none'},{transform:`translateY(${-19*270}px)`}],{ease:'cubic-bezier(.15,.6,.25,1)'});
|
||||||
|
/* ♪ 25,25 — 19 € atteint + « sans engagement » */
|
||||||
|
shake(25.25,6);sparks(460,790,25.25,{r0:200,r1:320,n:12});
|
||||||
|
slam('#se9',25.25,1.5);
|
||||||
|
camTo('#cam9',25.25,.08,'scale(1.08)');camTo('#cam9',25.33,.5,'scale(1.03) rotate(-1deg)');
|
||||||
|
/* ♪ 25,75 */
|
||||||
|
camTo('#cam9',25.75,.25,'scale(1.05) rotate(1deg)');
|
||||||
|
|
||||||
|
/* ♪ 26,0 — MASQUE CIRCULAIRE : signature, les arches se tracent */
|
||||||
|
vis('#s10',26,29.5);
|
||||||
|
an('#s10',26,.3,[{clipPath:'circle(0% at 50% 47%)'},{clipPath:'circle(80% at 50% 47%)'}]);
|
||||||
|
an('#arch1',26,.2,[{strokeDashoffset:1},{strokeDashoffset:0}],{ease:IO});
|
||||||
|
an('#arch2',26.2,.2,[{strokeDashoffset:1},{strokeDashoffset:0}],{ease:IO});
|
||||||
|
/* ♪ 26,5 — le point jaune tombe et rebondit */
|
||||||
|
an('#dot10',26.38,.3,[{opacity:1,transform:'translateY(-70px)'},{opacity:1,transform:'none',offset:.45},{opacity:1,transform:'translateY(-9px)',offset:.72},{opacity:1,transform:'none'}],{ease:LIN});
|
||||||
|
shake(26.5,8);sparks(dot10[0],dot10[1],26.5,{r0:50,r1:150});
|
||||||
|
camTo('#cam10',26.5,.08,'scale(1.08)');camTo('#cam10',26.58,.4,'scale(1.02)');
|
||||||
|
/* ♪ 26,75 — le nom */
|
||||||
|
slam('#nm10',26.75,1.4,.2);
|
||||||
|
/* ♪ 27,25 — bouton */
|
||||||
|
slam('#cta10',27.25,1.5,.2);shake(27.25,4);
|
||||||
|
camTo('#cam10',27.25,.1,'scale(1.05) rotate(-1deg)');
|
||||||
|
/* ♪ 27,75 — URL + pulsation douce du bouton */
|
||||||
|
slam('#url10',27.75,1.4);
|
||||||
|
camTo('#cam10',27.75,.4,'scale(1.04) rotate(1deg)');
|
||||||
|
an('#cta10',27.95,.5,[{transform:'none'},{transform:'scale(1.06)'},{transform:'none'}],{fill:'none',it:3,ease:IO});
|
||||||
|
/* ♪ 28,5 / 29,0 */
|
||||||
|
camTo('#cam10',28.5,.1,'scale(1.1) rotate(0deg)');camTo('#cam10',28.6,.4,'scale(1.06)');
|
||||||
|
camTo('#cam10',29,.25,'scale(1.04) rotate(-1deg)');
|
||||||
|
an('#c10',29.25,.25,[{opacity:1,transform:'none'},{opacity:0,transform:'scale(.9) translateY(-60px)'}],{ease:IN});
|
||||||
|
|
||||||
|
/* ♪ 29,5 — RACCORD DE BOUCLE : la carte en carton retombe au centre (identique à l'image 1) */
|
||||||
|
vis('#s1',29.5);
|
||||||
|
[['#cam1',{transform:'none'}],['#ballgrp',{transform:'none',filter:'blur(0px)'}],['#hand',{transform:'translateY(1100px)'}],
|
||||||
|
['#stopw',{opacity:0}],['#en2',{opacity:0}],['#cartonw',{opacity:0}],['#ink4',{opacity:0}],['#crease',{opacity:0}]].forEach(([e,p])=>set(e,29.5,p));
|
||||||
|
$$('.q2').forEach(w=>set(w,29.5,{opacity:0}));
|
||||||
|
$$('#hand .fing').forEach(f=>set(f,29.5,{transform:'none'}));
|
||||||
|
an('#carton',29.5,.42,[{transform:'translateY(-1400px) rotate(-30deg)',borderRadius:'28px',easing:'cubic-bezier(.5,0,1,.7)'},{transform:'translateY(24px) rotate(-3deg)',borderRadius:'28px',offset:.62},{transform:'translateY(-12px) rotate(-4.6deg)',borderRadius:'28px',offset:.82},{transform:'rotate(-4deg)',borderRadius:'28px'}],{ease:LIN});
|
||||||
|
shake(29.75,8);sparks(490,1230,29.75,{r0:20,r1:120,n:8});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Démarrage, mise à l'échelle, rejouer ---------- */
|
||||||
|
function fit(){const s=Math.min(innerWidth/1080,innerHeight/1920);$('#stage').style.transform=`scale(${s})`}
|
||||||
|
addEventListener('resize',fit);fit();
|
||||||
|
function seek(t){A.forEach(a=>{a.pause();a.currentTime=t*1000})}
|
||||||
|
window.seek=seek;
|
||||||
|
$('#replay').addEventListener('click',build);
|
||||||
|
addEventListener('keydown',e=>{if(e.code==='Space'){e.preventDefault();build()}});
|
||||||
|
Promise.race([document.fonts.load('800 100px Figtree').then(()=>document.fonts.ready),new Promise(r=>setTimeout(r,3000))]).then(()=>{
|
||||||
|
build();
|
||||||
|
const t=new URLSearchParams(location.search).get('t');
|
||||||
|
if(t!==null)seek(parseFloat(t));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
60
docs/video/voice.js
Normal file
60
docs/video/voice.js
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
// Voix off : chaque réplique est générée séparément puis calée sur la timeline de la vidéo
|
||||||
|
process.chdir(__dirname);
|
||||||
|
const { MsEdgeTTS, OUTPUT_FORMAT } = require('msedge-tts');
|
||||||
|
const ffmpeg = require('ffmpeg-static');
|
||||||
|
const { execFileSync } = require('child_process');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const VOICE = 'fr-FR-DeniseNeural';
|
||||||
|
// [début (s), fin max (s), texte, débit]
|
||||||
|
const LINES = [
|
||||||
|
[0.1, 1.4, 'Stop !', '+0%'],
|
||||||
|
[1.45, 3.0, 'Fini la carte en carton.', '+12%'],
|
||||||
|
[3.05, 4.0, 'Oubliée…', '+5%'],
|
||||||
|
[4.05, 5.0, 'Perdue…', '+5%'],
|
||||||
|
[5.1, 6.0, 'Jamais pleine.', '+8%'],
|
||||||
|
[6.25, 8.0, 'Et si elle était dans son téléphone ?', '+10%'],
|
||||||
|
[8.15, 10.4, 'Votre client scanne le QR code.', '+10%'],
|
||||||
|
[10.5, 12.0, 'Zéro appli à télécharger.', '+12%'],
|
||||||
|
[12.4, 15.0, 'Sa carte arrive dans Apple Wallet ou Google Wallet.', '+14%'],
|
||||||
|
[15.35, 17.95, 'À chaque passage, un tampon, en un scan.', '+12%'],
|
||||||
|
[18.25, 19.95, 'Au dixième, c’est offert !', '+12%'],
|
||||||
|
[20.55, 22.0, 'Une notif… et ils reviennent.', '+12%'],
|
||||||
|
[22.15, 23.25, 'Prête en cinq minutes.', '+12%'],
|
||||||
|
[23.35, 24.5, 'À vos couleurs.', '+8%'],
|
||||||
|
[24.55, 26.4, 'Dès dix-neuf euros par mois, sans engagement.', '+28%'],
|
||||||
|
[26.5, 27.3, 'Mon Espace Pro.', '+15%'],
|
||||||
|
[27.35, 29.45, 'Créez votre carte sur mon espace pro point e u.', '+22%'],
|
||||||
|
];
|
||||||
|
|
||||||
|
async function synth(text, rate, file) {
|
||||||
|
const tts = new MsEdgeTTS();
|
||||||
|
await tts.setMetadata(VOICE, OUTPUT_FORMAT.AUDIO_24KHZ_96KBITRATE_MONO_MP3);
|
||||||
|
const { audioStream } = tts.toStream(text, { rate });
|
||||||
|
const chunks = [];
|
||||||
|
await new Promise((res, rej) => { audioStream.on('data', c => chunks.push(c)); audioStream.on('end', res); audioStream.on('error', rej); });
|
||||||
|
tts.close();
|
||||||
|
fs.writeFileSync(file, Buffer.concat(chunks));
|
||||||
|
}
|
||||||
|
function toWav(src, dst) {
|
||||||
|
// 48 kHz mono, silences de début et de fin retirés
|
||||||
|
execFileSync(ffmpeg, ['-y', '-loglevel', 'error', '-i', src, '-af',
|
||||||
|
'silenceremove=start_periods=1:start_threshold=-45dB,areverse,silenceremove=start_periods=1:start_threshold=-45dB,areverse',
|
||||||
|
'-ar', '48000', '-ac', '1', '-c:a', 'pcm_s16le', dst]);
|
||||||
|
return (fs.statSync(dst).size - 44) / 2 / 48000;
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
fs.mkdirSync('vo', { recursive: true });
|
||||||
|
const plan = [];
|
||||||
|
for (let i = 0; i < LINES.length; i++) {
|
||||||
|
const [t, end, text, rate] = LINES[i];
|
||||||
|
const mp3 = `vo/${String(i).padStart(2, '0')}.mp3`, wav = mp3.replace('.mp3', '.wav');
|
||||||
|
await synth(text, rate, mp3);
|
||||||
|
const d = toWav(mp3, wav);
|
||||||
|
const ok = t + d <= end + .05;
|
||||||
|
console.log(`${ok ? 'OK ' : 'LONG'} ${t.toFixed(2)}→${(t + d).toFixed(2)} (max ${end}) ${text}`);
|
||||||
|
plan.push({ t, wav, d });
|
||||||
|
}
|
||||||
|
fs.writeFileSync('vo/plan.json', JSON.stringify(plan, null, 1));
|
||||||
|
})();
|
||||||
Loading…
Reference in a new issue