// 乱码解码字(scramble-decode)——终端黑客感文字入场。 // 标题 "DECODE SPEED" 每字符先高速跳随机字母/数字(每 2f 换一个,seed hash 取字符), // 从左到右逐个锁定:第 i 个字符在帧 20+i*6 锁定为真字符,锁定瞬间该字符反色闪 // (G.ink 色块白字 2f)随即恢复。跳动期字符 G.mid,锁定后 G.ink。 // 关键帧:0–20f 全员乱跳 → 20–86f 从左到右逐个锁定 → 87–130f 完全静止收尾。 import React from 'react'; import { useCurrentFrame } from 'remotion'; import { G } from '../../_fixtures/Fixtures'; const TEXT = 'DECODE SPEED'; const CHARSET = 'ABCDEF0123456789#$%&'; const LOCK_START = 20; // 第 0 个字符锁定帧 const LOCK_STEP = 6; // 相邻字符锁定间隔 const FLASH_LEN = 2; // 锁定反色闪持续帧数 // 帧确定伪随机 const h = (n: number) => { const s = Math.sin(n * 127.3) * 43758.5453; return s - Math.floor(s); }; export const ScrambleDecode: React.FC = () => { const frame = useCurrentFrame(); const chars = TEXT.split(''); const lockedCount = chars.filter((c, i) => c === ' ' || frame >= LOCK_START + i * LOCK_STEP).length; const allLocked = lockedCount === chars.length; return (
{chars.map((ch, i) => { if (ch === ' ') { return ; } const lockFrame = LOCK_START + i * LOCK_STEP; const locked = frame >= lockFrame; const flashing = locked && frame < lockFrame + FLASH_LEN; // 跳动期:每 2 帧换一个伪随机字符 const tick = Math.floor(frame / 2); const scrambleChar = CHARSET[Math.floor(h(i * 101 + tick * 7 + 13) * CHARSET.length)]; const shown = locked ? ch : scrambleChar; return ( {shown} ); })}
{/* 底部进度提示条:已锁定字符数比例,帮助读出"从左到右扫过"的推进感 */}
); };