// Camera: deriva constante por baixo de tudo (zoom, deslize e giro mínimos) e um soco em cada batida. // O quadro nunca fica parado. `batidas` são quadros absolutos do vídeo. import React from 'react'; import {AbsoluteFill, useCurrentFrame} from 'remotion'; export type CameraProps = {batidas?: number[]; forca?: number; children: React.ReactNode}; export const posCamera = (f: number, batidas: number[], forca = 1) => { let z = 1.014 + 0.012 * Math.sin(f / 120) + f * 0.00012, dx = Math.sin(f / 37) * 8, dy = Math.cos(f / 51) * 8; const rot = Math.sin(f / 83) * 0.003; for (const h of batidas) if (f >= h) { const d = Math.exp(-(f - h) / 7) * forca; z += 0.025 * d; dx += 5 * d * Math.sin((f - h) * 2.7 + h); dy += 5 * d * Math.cos((f - h) * 3.3 + h); } return {z, dx, dy, rot}; }; export const Camera: React.FC = ({batidas = [], forca = 1, children}) => { const c = posCamera(useCurrentFrame(), batidas, forca); return {children}; };