// RecorteForma: adesivo-explosão de papel (círculo de pontas) vermelho com texto grande em Abril Fatface, e uma tira rasgada preta com subtexto. // Estoura com overshoot, gira em passos e balança. Serve de selo de data ou oferta. import React from 'react'; import {COR, FONTE_TEXTO, FONTE_TITULO, caber, mola, seg, useF} from '../base'; import {rasgado} from '../lib/rasgado'; export type RecorteFormaProps = {texto: string; sub?: string; cor?: string; inicio?: number; y?: number; diametro?: number; tamanho?: number}; export const RecorteForma: React.FC = ({texto, sub, cor = COR.vermelho, inicio = 0, y = 700, diametro = 800, tamanho = 280}) => { const f = useF() - inicio; const p = mola(seg(f, 0, 12), 2.4); const pts = Array.from({length: 48}).map((_, i) => { const a = (i / 48) * Math.PI * 2, r = i % 2 ? 0.86 : 1; return `${50 + Math.cos(a) * 50 * r}% ${50 + Math.sin(a) * 50 * r}%`; }).join(','); const linhas = texto.split('\n'); const tam = Math.min(...linhas.map((l) => caber(l, tamanho, diametro * 0.62, FONTE_TITULO, 400, 0))); const ps = mola(seg(f, 10, 20), 2); return <>
{linhas.map((l, i) =>
{l}
)}
{sub &&
{sub}
} ; };