primocode 10.12.0 → 10.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/README.md +74 -12
  2. package/bin/primocode.js +148 -8
  3. package/lib/act.js +48 -1
  4. package/lib/catalogo.js +12 -1
  5. package/lib/config.js +1 -0
  6. package/lib/estudio/assinaturas/gerativo.json +1 -1
  7. package/lib/estudio/camadas.js +4 -0
  8. package/lib/estudio/cota.js +150 -0
  9. package/lib/estudio/dados/projetos/clube-ad5.json +105 -0
  10. package/lib/estudio/dados/projetos/clube-ae-sem-memoria.json +107 -0
  11. package/lib/estudio/dados/projetos/clube-agent.json +120 -0
  12. package/lib/estudio/dados/projetos/clube-antes-e-agora.json +86 -0
  13. package/lib/estudio/dados/projetos/clube-apresentando-clube.json +110 -0
  14. package/lib/estudio/dados/projetos/clube-bluevisa.json +106 -0
  15. package/lib/estudio/dados/projetos/clube-caught-in-the-fire.json +127 -0
  16. package/lib/estudio/dados/projetos/clube-chat-cliente-satisfeito.json +98 -0
  17. package/lib/estudio/dados/projetos/clube-chatgpt-anuncios.json +120 -0
  18. package/lib/estudio/dados/projetos/clube-claude-dj.json +140 -0
  19. package/lib/estudio/dados/projetos/clube-claude-mcp.json +142 -0
  20. package/lib/estudio/dados/projetos/clube-cleanui.json +106 -0
  21. package/lib/estudio/dados/projetos/clube-clinica-take-unico.json +128 -0
  22. package/lib/estudio/dados/projetos/clube-clinica.json +104 -0
  23. package/lib/estudio/dados/projetos/clube-clube-opener.json +125 -0
  24. package/lib/estudio/dados/projetos/clube-clube.json +108 -0
  25. package/lib/estudio/dados/projetos/clube-codigo.json +101 -0
  26. package/lib/estudio/dados/projetos/clube-distilbook.json +104 -0
  27. package/lib/estudio/dados/projetos/clube-drive-upload.json +115 -0
  28. package/lib/estudio/dados/projetos/clube-dub.json +119 -0
  29. package/lib/estudio/dados/projetos/clube-enxovaly.json +105 -0
  30. package/lib/estudio/dados/projetos/clube-fecha7.json +118 -0
  31. package/lib/estudio/dados/projetos/clube-filatov.json +128 -0
  32. package/lib/estudio/dados/projetos/clube-frame.json +108 -0
  33. package/lib/estudio/dados/projetos/clube-glass.json +118 -0
  34. package/lib/estudio/dados/projetos/clube-letra-em-apps.json +84 -0
  35. package/lib/estudio/dados/projetos/clube-letra-globo-3d.json +111 -0
  36. package/lib/estudio/dados/projetos/clube-letra-nos-apps.json +146 -0
  37. package/lib/estudio/dados/projetos/clube-letra-seis-mundos.json +100 -0
  38. package/lib/estudio/dados/projetos/clube-lula-3.json +146 -0
  39. package/lib/estudio/dados/projetos/clube-morph.json +119 -0
  40. package/lib/estudio/dados/projetos/clube-motion-designer.json +115 -0
  41. package/lib/estudio/dados/projetos/clube-motion-pacote.json +112 -0
  42. package/lib/estudio/dados/projetos/clube-movimento.json +103 -0
  43. package/lib/estudio/dados/projetos/clube-not-like-us.json +117 -0
  44. package/lib/estudio/dados/projetos/clube-pinterest-inspiracao.json +86 -0
  45. package/lib/estudio/dados/projetos/clube-pixel-e-tinta.json +108 -0
  46. package/lib/estudio/dados/projetos/clube-ponte.json +118 -0
  47. package/lib/estudio/dados/projetos/clube-processo-edit-tonal.json +126 -0
  48. package/lib/estudio/dados/projetos/clube-processo-motion-100-ia.json +109 -0
  49. package/lib/estudio/dados/projetos/clube-promo.json +114 -0
  50. package/lib/estudio/dados/projetos/clube-proposito.json +115 -0
  51. package/lib/estudio/dados/projetos/clube-rankhog.json +128 -0
  52. package/lib/estudio/dados/projetos/clube-recursao.json +116 -0
  53. package/lib/estudio/dados/projetos/clube-revelar.json +118 -0
  54. package/lib/estudio/dados/projetos/clube-robo.json +125 -0
  55. package/lib/estudio/dados/projetos/clube-shelby-ep2.json +144 -0
  56. package/lib/estudio/dados/projetos/clube-shelby.json +97 -0
  57. package/lib/estudio/dados/projetos/clube-solar-eclipse.json +96 -0
  58. package/lib/estudio/dados/projetos/clube-soldier.json +128 -0
  59. package/lib/estudio/dados/projetos/clube-som-de-cena.json +108 -0
  60. package/lib/estudio/dados/projetos/clube-spotify-candidatura.json +112 -0
  61. package/lib/estudio/dados/projetos/clube-tda-app.json +118 -0
  62. package/lib/estudio/dados/projetos/clube-tda-ia.json +75 -0
  63. package/lib/estudio/dados/projetos/clube-telegram-chat.json +118 -0
  64. package/lib/estudio/dados/projetos/clube-telegram-ilha.json +106 -0
  65. package/lib/estudio/dados/projetos/clube-tennessee-nike.json +132 -0
  66. package/lib/estudio/dados/projetos/clube-tudo-se-move.json +112 -0
  67. package/lib/estudio/dados/projetos/clube-uiad.json +107 -0
  68. package/lib/estudio/dados/projetos/clube-viralgrow.json +108 -0
  69. package/lib/estudio/dados/projetos/clube-whose-side.json +140 -0
  70. package/lib/estudio/dados/projetos/clube-youtube-inscrever.json +108 -0
  71. package/lib/estudio/dados/projetos/elementos-do-site-em-movimento.json +49 -0
  72. package/lib/estudio/dados/projetos/explainer-narrado.json +51 -0
  73. package/lib/estudio/dados/projetos/lancamento-de-produto.json +51 -0
  74. package/lib/estudio/dados/projetos/motion-so-com-sons.json +50 -0
  75. package/lib/estudio/dados/projetos/titulo-em-after-effects.json +51 -0
  76. package/lib/estudio/dados/projetos/tour-de-saas.json +50 -0
  77. package/lib/estudio/dados/projetos-ae/antes-e-agora/ae/cenas.jsx +733 -0
  78. package/lib/estudio/dados/projetos-ae/antes-e-agora/assets/fazer_assets.py +88 -0
  79. package/lib/estudio/dados/projetos-ae/letra-em-apps/ae/cenas.jsx +402 -0
  80. package/lib/estudio/dados/projetos-ae/letra-em-apps/assets/preparar_assets.py +17 -0
  81. package/lib/estudio/dados/projetos-ae/letra-em-apps/assets/svg_para_ae.py +25 -0
  82. package/lib/estudio/dados/projetos-ae/letra-nos-apps/BRIEF-AGENTES.md +31 -0
  83. package/lib/estudio/dados/projetos-ae/letra-nos-apps/README.md +53 -0
  84. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ROTEIRO-CENAS.md +69 -0
  85. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/A-agenda.jsx +148 -0
  86. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/B-docs.jsx +174 -0
  87. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/C-alttab.jsx +113 -0
  88. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/D-spotify.jsx +118 -0
  89. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/E-notas.jsx +146 -0
  90. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/F-jornal1.jsx +144 -0
  91. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/G-google.jsx +153 -0
  92. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/H-mapa.jsx +176 -0
  93. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/I-imagens.jsx +132 -0
  94. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/J-jornal2.jsx +191 -0
  95. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/K-maps.jsx +184 -0
  96. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/camera-movimentos.jsx +48 -0
  97. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/camera.jsx +57 -0
  98. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/card-spotify.jsx +98 -0
  99. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/digitar.jsx +38 -0
  100. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/jornal-comum.jsx +196 -0
  101. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/letra.jsx +23 -0
  102. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/letra_automatica.py +83 -0
  103. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/montagem.jsx +74 -0
  104. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/w-agenda/render_html.py +13 -0
  105. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/w-agenda/util.jsx +162 -0
  106. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/w-midia-comum.jsx +114 -0
  107. package/lib/estudio/dados/projetos-ae/letra-nos-apps/ae/wg-util.jsx +360 -0
  108. package/lib/estudio/dados/projetos-ae/letra-nos-apps/assets/F-jornal1/render_html.py +13 -0
  109. package/lib/estudio/dados/projetos-ae/letra-nos-apps/assets/render_w-midia.py +26 -0
  110. package/lib/estudio/dados/projetos-ae/letra-nos-apps/assets/w-midia-ferramentas/inclin.py +30 -0
  111. package/lib/estudio/dados/projetos-ae/letra-nos-apps/assets/w-midia-ferramentas/medir_d.py +36 -0
  112. package/lib/estudio/dados/projetos-ae/letra-nos-apps/assets/w-midia-ferramentas/medir_e.py +27 -0
  113. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/ajustar_movimentos.py +61 -0
  114. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/ancorar.py +74 -0
  115. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/assar.py +47 -0
  116. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/camera3d_jornal.py +172 -0
  117. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/comparar.py +32 -0
  118. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/dados_ae_jornal.py +46 -0
  119. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/folha_contato.py +28 -0
  120. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/homografia_jornal.py +74 -0
  121. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/integrar.py +44 -0
  122. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/medir_quadro_a_quadro.py +32 -0
  123. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/mesa_2d.py +64 -0
  124. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/plot_cenas.py +11 -0
  125. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/retificar_quadros.py +38 -0
  126. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/w-agenda/assar_ab.py +52 -0
  127. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/w-agenda/medir_ab.py +59 -0
  128. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/wg_ajustar_h.py +111 -0
  129. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/wg_corrige_cam.py +17 -0
  130. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/wg_ecc_cadeia.py +80 -0
  131. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/wg_finalizar_cam.py +65 -0
  132. package/lib/estudio/dados/projetos-ae/letra-nos-apps/camera/wg_mosaico.py +61 -0
  133. package/lib/estudio/dados/projetos-ae/letra-nos-apps/guia-do-metodo/tutorial-lyric-edit-interfaces/01-gramatica-e-roteiro.md +55 -0
  134. package/lib/estudio/dados/projetos-ae/letra-nos-apps/guia-do-metodo/tutorial-lyric-edit-interfaces/02-camera.md +66 -0
  135. package/lib/estudio/dados/projetos-ae/letra-nos-apps/guia-do-metodo/tutorial-lyric-edit-interfaces/03-montagem-no-ae.md +50 -0
  136. package/lib/estudio/dados/projetos-ae/letra-nos-apps/guia-do-metodo/tutorial-lyric-edit-interfaces/04-render-e-conferencia.md +43 -0
  137. package/lib/estudio/dados/projetos-ae/letra-nos-apps/guia-do-metodo/tutorial-lyric-edit-interfaces/05-abertura-celular-mergulho.md +43 -0
  138. package/lib/estudio/dados/projetos-ae/letra-nos-apps/guia-do-metodo/tutorial-lyric-edit-interfaces.md +42 -0
  139. package/lib/estudio/dados/projetos-ae/letra-nos-apps/transicao/atraso_imagem.py +31 -0
  140. package/lib/estudio/dados/projetos-ae/letra-nos-apps/transicao/fundo.py +56 -0
  141. package/lib/estudio/dados/projetos-ae/letra-nos-apps/transicao/juntar.py +45 -0
  142. package/lib/estudio/dados/projetos-ae/letra-nos-apps/transicao/montar.py +177 -0
  143. package/lib/estudio/dados/projetos-ae/letra-nos-apps/transicao/rastreio.py +74 -0
  144. package/lib/estudio/dados/projetos-ae/letra-nos-apps/transicao/sincronia.py +18 -0
  145. package/lib/estudio/dados/projetos-ae/pinterest-inspiracao/ae/cenas.jsx +530 -0
  146. package/lib/estudio/dados/projetos-ae/pinterest-inspiracao/assets/fazer_assets.py +107 -0
  147. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/assets/pessoas/figurinha.py +46 -0
  148. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/BRIEF-A.md +83 -0
  149. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/audio.py +179 -0
  150. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/confere.py +20 -0
  151. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/dados/tempo-parte1.js +1 -0
  152. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/dados/tempo-parte2.js +1 -0
  153. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/gerar_emojis.py +11 -0
  154. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/img/filmes/_indice.js +122 -0
  155. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/js/base.js +380 -0
  156. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/js/main.js +86 -0
  157. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/js/p1a.js +169 -0
  158. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/js/p1b.js +455 -0
  159. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/js/p1c.js +389 -0
  160. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/js/p2.js +379 -0
  161. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/comp-a/video.py +62 -0
  162. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/take-unico/README.md +65 -0
  163. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/take-unico/oraculo_take.py +137 -0
  164. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/take-unico/render_take.py +388 -0
  165. package/lib/estudio/dados/projetos-ae/processo-motion-100-ia/take-unico/take.js +235 -0
  166. package/lib/estudio/diretor.js +2 -1
  167. package/lib/estudio/editor.js +285 -0
  168. package/lib/estudio/efeitos-fabrica/terminal-digitando.jsx +2 -1
  169. package/lib/estudio/effectcraft.js +152 -0
  170. package/lib/estudio/exportar.js +181 -0
  171. package/lib/estudio/gerativo.js +44 -15
  172. package/lib/estudio/index.js +126 -5
  173. package/lib/estudio/kit/gerativo.jsx +15 -0
  174. package/lib/estudio/kit-ae/base.jsx +1146 -0
  175. package/lib/estudio/kit-ae/cenas.jsx +395 -0
  176. package/lib/estudio/kit-ae/primitivas.jsx +911 -0
  177. package/lib/estudio/kokoro.js +3 -1
  178. package/lib/estudio/maquina-diretor.js +393 -0
  179. package/lib/estudio/maquina-elementos.js +134 -0
  180. package/lib/estudio/maquina-layout.js +198 -0
  181. package/lib/estudio/maquina-som.js +478 -0
  182. package/lib/estudio/maquina-trilha.js +160 -0
  183. package/lib/estudio/maquina-voz.js +429 -0
  184. package/lib/estudio/maquina.js +516 -0
  185. package/lib/estudio/projetos.js +60 -0
  186. package/lib/estudio/remotion.js +6 -4
  187. package/lib/estudio/revisor.js +61 -0
  188. package/lib/estudio/voicestudio.js +81 -0
  189. package/lib/headless.js +71 -0
  190. package/lib/hooks.js +72 -0
  191. package/lib/local/cerebro.json +398 -12
  192. package/lib/local/entrada.js +46 -2
  193. package/lib/marca-kit.js +309 -0
  194. package/lib/mcp.js +286 -6
  195. package/lib/perigo.js +31 -3
  196. package/lib/planos.js +47 -19
  197. package/lib/preparar.js +111 -0
  198. package/lib/retomar.js +55 -0
  199. package/lib/sandbox.js +197 -0
  200. package/lib/skills.js +3 -1
  201. package/lib/tools.js +13 -4
  202. package/lib/ui.js +1 -1
  203. package/lib/video/auto.js +18 -3
  204. package/package.json +4 -2
  205. package/skills/after-effects/SKILL.md +52 -0
  206. package/skills/maquina-de-motion/SKILL.md +84 -0
  207. package/skills/motion-de-primeira/SKILL.md +33 -51
@@ -0,0 +1,395 @@
1
+ /* cenas.jsx — os 8 tipos de cena do estudio_motion, montados com o base.jsx (ES3).
2
+
3
+ O Node (maquina.js) entrega um PLANO em JSON; `montar(PLANO)` cria a comp MAIN, uma comp por cena e as
4
+ trocas. Cada cena tem a sua câmera (que nunca para) e os seus sons no tempo.
5
+
6
+ PLANO = { w, h, fps, fontes:{titulo, texto, destaque}, trocas:['encolhe'|'empurra'|'mascara'],
7
+ cenas:[{ tipo, dur, pal:{bg, fg, ac, mudo, card, brilho}, ...dados do tipo }] }
8
+ */
9
+
10
+ function kVert(comp) { return comp.height >= comp.width * 0.95; } // o quadrado 1:1 também empilha
11
+ function kU(comp) { return Math.min(comp.width, comp.height) / 1080; }
12
+ function kFillProp(L) { return L.property('ADBE Root Vectors Group').property(1).property('ADBE Vectors Group').property('ADBE Vector Graphic - Fill').property('ADBE Vector Fill Color'); }
13
+ function kBase(comp, P) {
14
+ fundo(comp, P.bg, { brilho: P.brilho });
15
+ var cam = camera(comp);
16
+ // a câmera (CAM) leva dois filhos: o título (direto nela) e o CONTEUDO, que desce e encolhe para caber abaixo da faixa reservada do título
17
+ var cont = comp.layers.addNull(comp.duration); cont.name = 'CONTEUDO'; cont.enabled = false; kPai(cont, cam.no);
18
+ kA(cont).setValue([comp.width / 2, comp.height / 2]); kP(cont).setValue([comp.width / 2, comp.height / 2]);
19
+ cam.camNo = cam.no; cam.no = cont; KIT.remap = null;
20
+ if (KIT.elementos.length && KIT.ambiente !== false && !KIT.semAmbiente) KIT.ambienteFn = function (cmp, cm) { kAmbiente(cmp, KIT.pal, cm); };
21
+ else KIT.ambienteFn = null;
22
+ return cam;
23
+ }
24
+ /* Os objetos do assunto, quando a cena não tem elemento próprio: 1 HERÓI (≥ 45% da largura útil) e 1 apoio (≥ 12% da largura, mais apagado),
25
+ postos NO FIM da cena no primeiro canto livre (sem tocar em texto nem em elemento já registrados; dentro dos 8% de margem). Sem espaço, sem enfeite. */
26
+ function kAmbiente(comp, P, cam) {
27
+ if (KIT.cenaComElemento || !cam) return;
28
+ var W = comp.width, H = comp.height, m = Math.min(W, H), ze = kZonaTexto(comp, false), mx = ze.x, my = ze.top, myb = ze.bot, k, colocados = [], R = [], ri;
29
+ for (ri = 0; ri < KIT.rects.length; ri++) if (KIT.rects[ri].cena == KIT.cenaIdx) R.push(kRectLayout(KIT.rects[ri]));
30
+ var tams = [m * 0.5, m * 0.15];
31
+ function livre(x, y, w) {
32
+ var x0 = x - w / 2 - 60, x1 = x + w / 2 + 60, y0 = y - w / 2 - 60, y1 = y + w / 2 + 60, i;
33
+ if (x - w / 2 < mx + W * 0.04 || x + w / 2 > W - mx - W * 0.04 || y - w / 2 < my + W * 0.04 || y + w / 2 > H - myb - W * 0.04) return false;
34
+ for (i = 0; i < R.length; i++) { var r = R[i]; if (x0 < r.x1 && x1 > r.x0 && y0 < r.y1 && y1 > r.y0) return false; }
35
+ for (i = 0; i < colocados.length; i++) { var q = colocados[i]; if (x0 < q[2] && x1 > q[0] && y0 < q[3] && y1 > q[1]) return false; }
36
+ return true;
37
+ }
38
+ for (k = 0; k < 2; k++) {
39
+ var w = tams[k], im = W * 0.07, xs = [mx + im + w / 2, W - mx - im - w / 2, W / 2], ys = [my + im + w / 2, H - myb - im - w / 2, H / 2], cands = [], a, b;
40
+ for (a = 0; a < 3; a++) for (b = 0; b < 3; b++) if (!(a == 2 && b == 2)) cands.push([xs[a], ys[b]]);
41
+ var ordem = (KIT.cenaIdx + k) % cands.length, n;
42
+ for (n = 0; n < cands.length; n++) {
43
+ var cd = cands[(ordem + n) % cands.length];
44
+ if (!livre(cd[0], cd[1], w)) continue;
45
+ var e = elemento(comp, KIT.cenaIdx + k * 2, { x: cd[0], y: cd[1], w: w, parent: cam.camNo || cam.no, flutua: 14, fase: k * 2.1 + KIT.cenaIdx, rot: k ? -12 : 10, entrada: 'pop', t0: 0.12 + k * 0.12, quique: 0.88, nome: 'ambiente' });
46
+ colocados.push([cd[0] - w / 2 - 60, cd[1] - w / 2 - 60, cd[0] + w / 2 + 60, cd[1] + w / 2 + 60]);
47
+ break;
48
+ }
49
+ }
50
+ }
51
+ // pontos que estalam em volta de um centro (confete discreto), com som
52
+ function kEstouro(comp, cam, cx, cy, t, cor, n, raio, som0) {
53
+ var i;
54
+ for (i = 0; i < n; i++) {
55
+ var a = (i / n) * Math.PI * 2 + 0.4, r = raio * (0.8 + 0.4 * ((i * 37) % 10) / 10), d = 10 + (i % 3) * 6;
56
+ var L = forma(comp, 'circulo', { x: cx, y: cy, w: d * 2, cor: cor, parent: cam.no, nome: 'estouro', alfa: 0 });
57
+ curva(kP(L), [[t, [cx, cy], null, 20], [t + 0.7, [cx + Math.cos(a) * r, cy + Math.sin(a) * r], 85, null]]);
58
+ curva(kO(L), [[t - 0.04, 0, null, 30], [t, 100, null, 30], [t + 0.2, 100, 50, 30], [t + 0.75, 0, 70, null]]);
59
+ curva(kS(L), [[t, [40, 40], null, 20], [t + 0.25, [100, 100], 70, 30], [t + 0.75, [20, 20], 70, null]]);
60
+ }
61
+ if (som0 !== false) som(t, 'pop', 0.8);
62
+ }
63
+
64
+ // ---------------------------------------------------------------- gancho
65
+ function cenaGancho(comp, P, d) {
66
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.14;
67
+ var ty = v ? H * 0.42 : H * 0.44;
68
+ var tit = texto(comp, d.titulo || '', { tamanho: (v ? 150 : 128) * u, cor: P.fg, corDestaque: P.ac, x: W / 2, y: ty, parent: cam.no, entrada: d.entrada || 'voa', t0: T0, largura: W * (v ? 0.86 : 0.78), maxLinhas: 4 });
69
+ var i;
70
+ for (i = 0; i < tit.tempos.length; i++) som(tit.tempos[i], i % 2 ? 'tique' : 'pop', i ? 0.45 : 0.7);
71
+ if (tit.camadas.length) som(tit.fim - 0.25, 'brilho', 0.5);
72
+ var yb = ty + tit.h / 2 + 90 * u;
73
+ if (d.sub) {
74
+ var sb = texto(comp, d.sub, { fonte: P.fonteTexto, tamanho: 54 * u, cor: P.mudo, x: W / 2, y: yb, parent: cam.no, entrada: 'sobe', t0: tit.fim + 0.05, largura: W * 0.74, maxLinhas: 3, entreLinhas: 1.25 });
75
+ som(tit.fim + 0.08, 'tique', 0.4);
76
+ }
77
+ cam.empurra(0.9, 0, -24 * u, 1.05).empurra(comp.duration - 0.3, 0, 30 * u, 1.1);
78
+ fecha(comp);
79
+ }
80
+
81
+ // ---------------------------------------------------------------- celular
82
+ function cenaCelular(comp, P, d) {
83
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.12;
84
+ var esc = v ? 0.66 * H / 960 * 0.92 : 0.7 * H / 960;
85
+ var px = v ? W / 2 : W * 0.7, py = v ? H * 0.585 : H * 0.5;
86
+ var tit;
87
+ if (d.titulo) {
88
+ tit = texto(comp, d.titulo, { tamanho: (v ? 104 : 96) * u, cor: P.fg, corDestaque: P.ac, x: v ? W / 2 : W * 0.3, y: v ? H * 0.15 : H * 0.5, parent: cam.no, entrada: 'palavra', t0: T0, largura: v ? W * 0.88 : W * 0.46, maxLinhas: 3 });
89
+ var i0; for (i0 = 0; i0 < tit.tempos.length; i0++) som(tit.tempos[i0], 'pop', 0.45);
90
+ }
91
+ var cel = celular(comp, { x: px, y: py, escala: esc, parent: cam.no, t0: T0 + 0.1, tela: P.telaCor || '#F6F6F8' });
92
+ var tq = d.toques && d.toques.length ? d.toques : ['Agendar', 'Confirmar'];
93
+ tq = tq.slice(0, 4);
94
+ // cabeçalho da tela
95
+ var cab = texto(comp, d.tela && d.tela.charAt && d.tela.charAt(0) != '#' && d.tela.indexOf('.') < 0 ? d.tela : (d.cabecalho || 'Hoje'), { tamanho: 54, cor: '#1B1B1F', x: 0, y: -330, parent: cel.no, entrada: 'sobe', t0: T0 + 0.7, largura: 360, maxLinhas: 1, sublinhado: false });
96
+ var n = tq.length, y0 = -150, passo = 124, i;
97
+ for (i = 0; i < n; i++) {
98
+ var ti = T0 + 1.0 + i * 0.85, yy = y0 + i * passo;
99
+ var card = forma(comp, 'retangulo', { x: 0, y: yy, w: 372, h: 96, r: 30, cor: '#FFFFFF', traco: '#E3E3E8', tracoL: 3, parent: cel.no, entrada: 'pop', t0: ti, quique: 0.55, nome: 'item' });
100
+ var bolinha = forma(comp, 'circulo', { x: -138, y: yy, w: 44, cor: '#E3E3E8', parent: cel.no, entrada: 'pop', t0: ti + 0.04, nome: 'bolinha' });
101
+ var tx = texto(comp, String(tq[i]), { tamanho: 34, cor: '#1B1B1F', x: 30, y: yy, parent: cel.no, entrada: 'sobe', t0: ti + 0.06, largura: 224, maxLinhas: 1, sublinhado: false });
102
+ som(ti, 'pop', 0.55);
103
+ var tt = ti + 0.55;
104
+ cel.toque(tt, 100, yy, { cor: '#B7B7C0' });
105
+ curva(kS(card), [[tt, [100, 100], null, 25], [tt + 0.08, [93, 93], 70, 40], [tt + 0.3, [100, 100], 70, null]]);
106
+ try { curva(kFillProp(bolinha), [[tt, kCor('#E3E3E8'), null, 30], [tt + 0.15, kCor(P.ac), 60, null]]); } catch (e) { }
107
+ check(comp, { x: -138, y: yy, tam: 24, cor: '#FFFFFF', parent: cel.no, t0: tt + 0.08 });
108
+ som(tt + 0.12, 'ponto' + (1 + i % 5), 0.5);
109
+ }
110
+ cel.sai(T0 + 1.0 + n * 0.85 + 0.2);
111
+ cam.empurra(0.9, v ? 0 : 60 * u, v ? 20 * u : 0, 1.03).empurra(comp.duration - 0.3, v ? 0 : 40 * u, v ? 60 * u : 0, v ? 1.1 : 1.12);
112
+ fecha(comp);
113
+ }
114
+
115
+ // ---------------------------------------------------------------- número
116
+ function cenaNumero(comp, P, d) {
117
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.14, R = 1.25;
118
+ var val = String(d.valor == null ? '100' : d.valor);
119
+ var m = val.match(/^([^0-9]*)([0-9][0-9.,]*)(.*)$/);
120
+ var pre = m ? m[1] : '', num = m ? m[2] : '0', suf = m ? m[3] : '';
121
+ var alvo = parseFloat(num.replace(/\./g, '').replace(',', '.'));
122
+ if (isNaN(alvo)) alvo = 0;
123
+ var dec = num.indexOf(',') >= 0 ? num.length - num.indexOf(',') - 1 : 0;
124
+ var cx = W / 2, cy = v ? H * 0.42 : H * 0.44, D = Math.min(W, H) * (v ? 0.8 : 0.6);
125
+ var anel = forma(comp, 'circulo', { x: cx, y: cy, w: D, traco: P.card, tracoL: 22 * u, parent: cam.no, entrada: 'cresce', t0: T0, nome: 'trilho' });
126
+ var prog = forma(comp, 'circulo', { x: cx, y: cy, w: D, traco: P.ac, tracoL: 22 * u, parent: cam.no, nome: 'progresso' });
127
+ kR(prog).setValue(-90);
128
+ var g = prog.property('ADBE Root Vectors Group').property(1).property('ADBE Vectors Group');
129
+ var tm = g.addProperty('ADBE Vector Filter - Trim');
130
+ curva(tm.property('ADBE Vector Trim End'), [[T0 + 0.1, 0, null, 20], [T0 + 0.1 + R, 100, 80, null]]);
131
+ try { g.property('ADBE Vector Graphic - Stroke').property('ADBE Vector Stroke Line Cap').setValue(2); } catch (e) { }
132
+ // o número rolando
133
+ var fmt = alvo >= 1000 || num.indexOf('.') >= 0 ? true : false;
134
+ var final = pre + num + suf;
135
+ var fonte = P.fonteTitulo, tam = (v ? 300 : 280) * u;
136
+ var L = comp.layers.addText(final); L.name = 'numero'; kPai(L, cam.no);
137
+ kDoc(L, fonte, tam, P.fg);
138
+ var wmax = D * 0.8, w = L.sourceRectAtTime(0, false).width;
139
+ while (w > wmax && tam > 40) { tam *= 0.9; kDoc(L, fonte, tam, P.fg); w = L.sourceRectAtTime(0, false).width; }
140
+ kP(L).setValue([cx, cy + tam * 0.33]);
141
+ var td = L.property('ADBE Text Properties').property('ADBE Text Document');
142
+ var ex = 'var n = ease(time, ' + (T0 + 0.1) + ', ' + (T0 + 0.1 + R) + ', 0, ' + alvo + ');' +
143
+ 'var s = ' + (dec ? 'n.toFixed(' + dec + ').replace(".", ",")' : 'String(Math.round(n))') + ';' +
144
+ (fmt ? 's = s.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ".");' : '') +
145
+ 'if (time < ' + (T0) + ') s = "0"; "' + pre.replace(/"/g, '') + '" + s + "' + suf.replace(/"/g, '') + '";';
146
+ td.expression = ex;
147
+ curva(kO(L), [[T0, 0, null, 30], [T0 + 0.2, 100, 60, null]]);
148
+ curva(kS(L), [[T0 + 0.1 + R, [100, 100], null, 25], [T0 + 0.1 + R + 0.12, [112, 112], 70, 40], [T0 + 0.1 + R + 0.45, [100, 100], 70, null]]);
149
+ som(T0 + 0.1, 'subida', 0.7);
150
+ som(T0 + 0.1 + R, 'impacto', 0.8); som(T0 + 0.1 + R + 0.02, 'brilho', 0.6);
151
+ var rot = texto(comp, d.rotulo || '', { fonte: P.fonteTexto, tamanho: 58 * u, cor: P.mudo, x: W / 2, y: v ? cy + D / 2 + 150 * u : cy + D / 2 + 85 * u, parent: cam.no, entrada: 'sobe', t0: T0 + 0.1 + R + 0.1, largura: W * 0.8, maxLinhas: 3, sublinhado: false, entreLinhas: 1.2 });
152
+ kEstouro(comp, cam, cx, cy, T0 + 0.1 + R + 0.02, P.ac, 10, D * 0.62, false);
153
+ cam.empurra(0.8, 0, 0, 1.0).empurra(T0 + 0.1 + R, 0, -20 * u, 1.12).empurra(comp.duration - 0.2, 0, 10, 1.14);
154
+ fecha(comp);
155
+ }
156
+
157
+ // ---------------------------------------------------------------- lista (itens em laço: o destaque percorre e volta ao primeiro)
158
+ function cenaLista(comp, P, d) {
159
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.12;
160
+ var it = (d.itens && d.itens.length ? d.itens : ['Item um', 'Item dois', 'Item três']).slice(0, 5), n = it.length, i;
161
+ var altura = Math.min((v ? 190 : 150) * u, (H * (v ? 0.62 : 0.8)) / n - 24 * u), gap = 22 * u, wc = W * (v ? 0.86 : 0.62);
162
+ var total = n * altura + (n - 1) * gap, top = (v ? H * 0.5 : H * 0.5) - total / 2 + (d.titulo ? 70 * u : 0);
163
+ if (d.titulo) {
164
+ var tt = texto(comp, d.titulo, { tamanho: (v ? 88 : 78) * u, cor: P.fg, corDestaque: P.ac, x: W / 2, y: top - 130 * u, parent: cam.no, entrada: 'sobe', t0: T0, largura: W * 0.84, maxLinhas: 2 });
165
+ som(T0, 'tique', 0.5);
166
+ }
167
+ var ys = [];
168
+ for (i = 0; i < n; i++) {
169
+ var y = top + altura / 2 + i * (altura + gap), ti = T0 + 0.3 + i * 0.32, dir = i % 2 ? 1 : -1; ys.push(y);
170
+ var card = forma(comp, 'pilula', { x: W / 2, y: y, w: wc, h: altura, cor: P.card, parent: cam.no, nome: 'item' });
171
+ curva(kO(card), [[ti, 0, null, 30], [ti + 0.15, 100, 60, null]]);
172
+ mola(kP(card), ti, [W / 2 + dir * W * 0.4, y], [W / 2, y], { quique: 0.45, dur: 0.65 });
173
+ var dot = forma(comp, 'circulo', { x: W / 2 - wc / 2 + altura / 2, y: y, w: altura * 0.56, cor: P.ac, parent: cam.no, entrada: 'pop', t0: ti + 0.12, quique: 0.7, nome: 'marca' });
174
+ check(comp, { x: W / 2 - wc / 2 + altura / 2, y: y, tam: altura * 0.3, cor: P.bg, parent: cam.no, t0: ti + 0.22 });
175
+ texto(comp, String(it[i]), { tamanho: Math.min(66 * u, altura * 0.4), cor: P.fg, corDestaque: P.ac, x: W / 2 + altura * 0.3, y: y, parent: cam.no, entrada: 'sobe', t0: ti + 0.1, largura: wc - altura * 1.5, maxLinhas: 2, sublinhado: false });
176
+ som(ti + 0.05, 'ponto' + (1 + i % 5), 0.6);
177
+ }
178
+ // o laço: um contorno que percorre os itens e fecha o ciclo voltando ao primeiro
179
+ var tl = T0 + 0.3 + n * 0.32 + 0.25;
180
+ var cur = forma(comp, 'pilula', { x: W / 2, y: ys[0], w: wc + 24 * u, h: altura + 24 * u, traco: P.ac, tracoL: 8 * u, parent: cam.no, nome: 'laco', alfa: 0 });
181
+ var ky = [[tl, [W / 2, ys[0]], null, 25]], ko = [[tl, 0, null, 30], [tl + 0.15, 100, 60, 30]];
182
+ for (i = 1; i < n; i++) ky.push([tl + i * 0.42, [W / 2, ys[i]], 70, 25]);
183
+ ky.push([tl + n * 0.42, [W / 2, ys[0]], 70, null]);
184
+ curva(kP(cur), ky); curva(kO(cur), ko);
185
+ for (i = 1; i <= n; i++) som(tl + i * 0.42 - 0.05, 'tique', 0.4);
186
+ cam.empurra(0.8, 0, -10 * u, 1.03).empurra(comp.duration - 0.2, 0, 20 * u, 1.08);
187
+ fecha(comp);
188
+ }
189
+
190
+ // ---------------------------------------------------------------- antes e depois
191
+ function cenaAntesDepois(comp, P, d) {
192
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.12;
193
+ var cw = v ? W * 0.84 : W * 0.38, ch = v ? H * 0.26 : H * 0.56;
194
+ var ax = v ? W / 2 : W * 0.26, ay = v ? H * 0.34 : H * 0.5, bx = v ? W / 2 : W * 0.74, by = v ? H * 0.68 : H * 0.5;
195
+ var A = forma(comp, 'retangulo', { x: ax, y: ay, w: cw, h: ch, r: 56 * u, cor: P.card, traco: P.mudo, tracoL: 4 * u, parent: cam.no, entrada: 'pop', t0: T0, quique: 0.4, nome: 'antes' });
196
+ var la = forma(comp, 'pilula', { x: ax, y: ay - ch / 2, w: 260 * u, h: 80 * u, cor: P.mudo, parent: cam.no, entrada: 'pop', t0: T0 + 0.15, nome: 'rotulo antes' });
197
+ texto(comp, 'ANTES', { fonte: P.fonteTitulo, tamanho: 44 * u, cor: P.bg, x: ax, y: ay - ch / 2, parent: cam.no, entrada: 'sobe', t0: T0 + 0.18, largura: 200 * u, maxLinhas: 1, sublinhado: false });
198
+ texto(comp, d.antes || '', { fonte: P.fonteTexto, tamanho: 64 * u, cor: P.mudo, x: ax, y: ay + 20 * u, parent: cam.no, entrada: 'palavra', t0: T0 + 0.3, largura: cw * 0.82, maxLinhas: 4, sublinhado: false });
199
+ som(T0, 'pop', 0.6); som(T0 + 0.3, 'tique', 0.4);
200
+ // o antes treme de leve, cansado
201
+ kP(A).expression = 'value + [Math.sin(time*18)*3, 0]';
202
+ var t2 = T0 + 1.2;
203
+ var seta = texto(comp, '>', { fonte: P.fonteTitulo, tamanho: 190 * u, cor: P.ac, x: v ? W / 2 : W / 2, y: v ? H * 0.5 : H * 0.5, parent: cam.no, entrada: 'palavra', t0: t2 - 0.25, sublinhado: false, largura: 200, sobrepoe: true, semAuditoria: true });
204
+ if (v) for (var s = 0; s < seta.camadas.length; s++) kR(seta.camadas[s]).expression = 'value + 90';
205
+ som(t2 - 0.25, 'swoosh', 0.6);
206
+ var B = forma(comp, 'retangulo', { x: bx, y: by, w: cw, h: ch, r: 56 * u, cor: P.ac, parent: cam.no, nome: 'depois' });
207
+ var cor2 = kLum(P.ac) > 0.5 ? '#14110F' : '#FFFFFF';
208
+ mola(kS(B), t2, [60, 60], [100, 100], { quique: 0.7, dur: 0.75 });
209
+ curva(kO(B), [[t2, 0, null, 30], [t2 + 0.1, 100, 60, null]]);
210
+ mola(kR(B), t2, v ? 3 : -3, 0, { quique: 0.5, dur: 0.8 });
211
+ var lb = forma(comp, 'pilula', { x: bx, y: by - ch / 2, w: 290 * u, h: 80 * u, cor: P.fg, parent: cam.no, entrada: 'pop', t0: t2 + 0.15, nome: 'rotulo depois' });
212
+ texto(comp, 'DEPOIS', { fonte: P.fonteTitulo, tamanho: 44 * u, cor: P.bg, x: bx, y: by - ch / 2, parent: cam.no, entrada: 'sobe', t0: t2 + 0.18, largura: 220 * u, maxLinhas: 1, sublinhado: false });
213
+ texto(comp, d.depois || '', { tamanho: 96 * u, cor: cor2, corDestaque: cor2, x: bx, y: by + 24 * u, parent: cam.no, entrada: 'palavra', t0: t2 + 0.32, largura: cw * 0.84, maxLinhas: 4, sublinhado: false });
214
+ som(t2, 'impacto', 0.7); som(t2 + 0.05, 'brilho', 0.6);
215
+ kEstouro(comp, cam, bx, by, t2 + 0.05, P.fg, 8, ch * 0.75, false);
216
+ cam.empurra(0.8, v ? 0 : -60 * u, v ? -120 * u : 0, 1.02).empurra(t2 + 0.5, v ? 0 : 70 * u, v ? 130 * u : 0, 1.1).empurra(comp.duration - 0.2, v ? 0 : 90 * u, v ? 150 * u : 0, 1.13);
217
+ fecha(comp);
218
+ }
219
+
220
+ // ---------------------------------------------------------------- ícones que estalam em volta
221
+ function cenaIcones(comp, P, d) {
222
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.12;
223
+ var it = (d.itens && d.itens.length ? d.itens : ['Um', 'Dois', 'Três']).slice(0, 6), n = it.length, i;
224
+ var cx = W / 2, cy = v ? H * 0.46 : H * 0.5, R = Math.min(W, H) * (v ? 0.28 : 0.34), bw = Math.min(W, H) * (v ? 0.2 : 0.22);
225
+ var hub = forma(comp, 'circulo', { x: cx, y: cy, w: bw * 1.35, cor: P.ac, parent: cam.no, entrada: 'pop', t0: T0, quique: 0.55, nome: 'centro' });
226
+ var hc = kLum(P.ac) > 0.5 ? '#14110F' : '#FFFFFF';
227
+ if (d.titulo) texto(comp, d.titulo, { tamanho: 58 * u, cor: hc, corDestaque: hc, x: cx, y: cy, parent: cam.no, entrada: 'palavra', t0: T0 + 0.1, largura: bw * 1.1, maxLinhas: 3, sublinhado: false });
228
+ som(T0, 'pop', 0.8);
229
+ for (i = 0; i < n; i++) {
230
+ var a = -Math.PI / 2 + i * Math.PI * 2 / n, ti = T0 + 0.45 + i * 0.26;
231
+ var x = cx + Math.cos(a) * R * (v ? 1.0 : 1.35), y = cy + Math.sin(a) * R * (v ? 1.18 : 1.0);
232
+ var lig = forma(comp, 'retangulo', { x: (cx + x) / 2, y: (cy + y) / 2, w: Math.sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy)), h: 6 * u, cor: P.mudo, parent: cam.no, nome: 'liga', alfa: 0 });
233
+ kR(lig).setValue(Math.atan2(y - cy, x - cx) * 180 / Math.PI);
234
+ curva(kO(lig), [[ti - 0.1, 0, null, 30], [ti + 0.1, 45, 60, null]]);
235
+ var b = forma(comp, 'circulo', { x: x, y: y, w: bw, cor: P.card, traco: P.ac, tracoL: 7 * u, parent: cam.no, entrada: 'pop', t0: ti, quique: 0.75, nome: 'icone' });
236
+ var ini = String(it[i]).replace(/[^A-Za-zÀ-ÿ0-9]/g, '').charAt(0).toUpperCase() || '+';
237
+ if (KIT.elementos.length) elemento(comp, i, { x: x, y: y, w: bw * 0.62, parent: cam.no, entrada: 'pop', t0: ti + 0.05, quique: 0.7 });
238
+ else texto(comp, ini, { fonte: P.fonteTitulo, tamanho: bw * 0.52, cor: P.ac, corDestaque: P.ac, x: x, y: y, parent: cam.no, entrada: 'palavra', t0: ti + 0.05, sublinhado: false, largura: bw });
239
+ texto(comp, String(it[i]), { opcional: true, fonte: P.fonteTexto, tamanho: 38 * u, cor: P.fg, x: x, y: y + bw / 2 + 44 * u, parent: cam.no, entrada: 'sobe', t0: ti + 0.12, largura: Math.min(W * 0.3, 340 * u), maxLinhas: 2, sublinhado: false });
240
+ kP(b).expression = 'value + [Math.sin(time*2.1+' + i + ')*9, Math.cos(time*1.7+' + i + ')*9]';
241
+ som(ti, 'ponto' + (1 + i % 5), 0.7);
242
+ }
243
+ cam.empurra(0.9, 0, 0, 1.0).empurra(T0 + 0.45 + n * 0.26, 0, -20 * u, 1.1).empurra(comp.duration - 0.2, 0, 10 * u, 1.14);
244
+ fecha(comp);
245
+ }
246
+
247
+ // ---------------------------------------------------------------- citação
248
+ function cenaCitacao(comp, P, d) {
249
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.14;
250
+ var aspas = texto(comp, '“', { fonte: P.fonteDestaque, tamanho: 520 * u, cor: P.ac, corDestaque: P.ac, x: v ? W * 0.2 : W * 0.14, y: v ? H * 0.27 : H * 0.3, parent: cam.no, entrada: 'palavra', t0: T0, sublinhado: false, largura: 600, sobrepoe: true });
251
+ som(T0, 'pop', 0.7);
252
+ var tx = texto(comp, d.texto || '', { tamanho: (v ? 92 : 84) * u, cor: P.fg, corDestaque: P.ac, x: W / 2, y: v ? H * 0.5 : H * 0.52, parent: cam.no, entrada: 'palavra', t0: T0 + 0.35, passo: 0.14, largura: W * (v ? 0.82 : 0.7), maxLinhas: 6 });
253
+ var i; for (i = 0; i < tx.tempos.length; i++) som(tx.tempos[i], 'tique', 0.4);
254
+ if (d.autor) {
255
+ var yy = tx.y + tx.h / 2 + 90 * u;
256
+ var barra = forma(comp, 'pilula', { x: W / 2 - 150 * u, y: yy, w: 90 * u, h: 8 * u, cor: P.ac, parent: cam.no, nome: 'barra' });
257
+ kA(barra).setValue([-45 * u, 0]);
258
+ curva(kS(barra), [[tx.fim, [0, 100], null, 30], [tx.fim + 0.4, [100, 100], 80, null]]);
259
+ texto(comp, String(d.autor), { fonte: P.fonteTexto, tamanho: 46 * u, cor: P.mudo, x: W / 2 + 50 * u, y: yy, parent: cam.no, entrada: 'sobe', t0: tx.fim + 0.05, largura: W * 0.6, maxLinhas: 1, sublinhado: false });
260
+ som(tx.fim, 'brilho', 0.5);
261
+ }
262
+ cam.empurra(0.9, 0, 0, 1.04).empurra(comp.duration - 0.2, 20 * u, 40 * u, 1.12);
263
+ fecha(comp);
264
+ }
265
+
266
+ // ---------------------------------------------------------------- CTA
267
+ /* O CTA: título que voa, botão SÓLIDO com brilho que varre (Merge Paths em Intersect: o brilho só existe dentro da pílula) e um
268
+ ícone; o cursor entra, o botão afunda e volta com quique, estoura em ondas e partículas, com clique + impacto. Sem camada fantasma. */
269
+ function cenaCta(comp, P, d) {
270
+ var W = comp.width, H = comp.height, u = kU(comp), cam = kBase(comp, P), v = kVert(comp), T0 = 0.1, i;
271
+ var tit = texto(comp, d.titulo || '', { tamanho: (v ? 140 : 116) * u, cor: P.fg, corDestaque: P.ac, x: W / 2, y: v ? H * 0.34 : H * 0.34, parent: cam.no, entrada: 'voa', t0: T0, largura: W * (v ? 0.86 : 0.74), maxLinhas: 3 });
272
+ for (i = 0; i < tit.tempos.length; i++) som(tit.tempos[i], i % 2 ? 'tique' : 'pop', 0.5);
273
+ var bw = v ? W * 0.84 : Math.min(W * 0.5, 780 * u), bh = (v ? 230 : 158) * u, bx = W / 2, by = v ? H * 0.66 : H * 0.7, tb = Math.max(tit.fim * 0.8, T0 + 0.5);
274
+ var ink = kSobre(P);
275
+ KIT.rects.push({ cena: KIT.cenaIdx, x0: bx - bw / 2, x1: bx + bw / 2, y0: by - bh / 2, y1: by + bh / 2, t0: 0, t1: 1, texto: false, sobrepoe: true, livre: true, nome: 'botao' });
276
+ var btn = grupo(comp, { x: bx, y: by, parent: cam.no, nome: 'botao-cta' });
277
+ // o corpo sólido + o brilho que varre, na MESMA camada de forma: pílula, paralelogramo, Merge Paths (Intersect), preenchimento branco
278
+ var corpo = forma(comp, 'pilula', { x: 0, y: 0, w: bw, h: bh, cor: P.ac, traco: kMisturar(P.ac, '#FFFFFF', 0.55), tracoL: 5 * u, parent: btn, nome: 'botao-corpo' });
279
+ try {
280
+ var br = comp.layers.addShape(); br.name = 'botao-brilho'; kPai(br, btn);
281
+ var gr = br.property('ADBE Root Vectors Group').addProperty('ADBE Vector Group'), vv = gr.property('ADBE Vectors Group');
282
+ var pl = vv.addProperty('ADBE Vector Shape - Rect'); pl.property('ADBE Vector Rect Size').setValue([bw, bh]); pl.property('ADBE Vector Rect Roundness').setValue(bh / 2);
283
+ var pg = vv.addProperty('ADBE Vector Shape - Group'), S0 = new Shape(), S1 = new Shape(), zz = [[0, 0], [0, 0], [0, 0], [0, 0]], lw = 120 * u, sk = 60 * u;
284
+ S0.vertices = [[-bw / 2 - lw - sk, bh], [-bw / 2 - sk, bh], [-bw / 2, -bh], [-bw / 2 - lw, -bh]]; S0.inTangents = zz; S0.outTangents = zz; S0.closed = true;
285
+ S1.vertices = [[bw / 2 + sk * 0, bh], [bw / 2 + lw + sk * 0, bh], [bw / 2 + lw + sk, -bh], [bw / 2 + sk, -bh]]; S1.inTangents = zz; S1.outTangents = zz; S1.closed = true;
286
+ var sp = pg.property('ADBE Vector Shape'); sp.setValue(S0);
287
+ var ts = tb + 0.55;
288
+ sp.setValueAtTime(kFrame(ts), S0); sp.setValueAtTime(kFrame(ts) + 0.7, S1);
289
+ sp.setValueAtTime(kFrame(ts) + 1.9, S0); sp.setValueAtTime(kFrame(ts) + 2.6, S1); // varre de novo, sem parar
290
+ var mg = vv.addProperty('ADBE Vector Filter - Merge'); mg.property('ADBE Vector Merge Type').setValue(4);
291
+ vv.addProperty('ADBE Vector Graphic - Fill').property('ADBE Vector Fill Color').setValue([1, 1, 1]);
292
+ kO(br).setValue(55);
293
+ kP(br).setValue([0, 0]);
294
+ } catch (e) { KIT.avisos.push('cena ' + KIT.cenaIdx + ': brilho do botão indisponível'); }
295
+ // o ícone (seta) e o rótulo
296
+ var ic = caminho(comp, [[-22 * u, 0], [24 * u, 0]], { cor: ink, esp: 11 * u, parent: btn, nome: 'seta-haste' });
297
+ caminho(comp, [[6 * u, -20 * u], [26 * u, 0], [6 * u, 20 * u]], { cor: ink, esp: 11 * u, parent: btn, nome: 'seta-ponta' });
298
+ var arrows = [];
299
+ texto(comp, d.botao || 'Começar agora', { fonte: P.fonteTitulo, tamanho: (v ? 84 : 58) * u, cor: ink, corDestaque: ink, x: -28 * u, y: 0, parent: btn, entrada: 'sobe', t0: tb + 0.08, largura: bw * 0.7, maxLinhas: 1, sublinhado: false, livre: true, fala: false });
300
+ var iconX = bw / 2 - 74 * u;
301
+ var j, kids = [];
302
+ // posiciona a seta à direita do rótulo
303
+ for (j = 0; j < comp.numLayers; j++) { var Ly = comp.layer(j + 1); if (Ly.name == 'seta-haste' || Ly.name == 'seta-ponta') kP(Ly).setValue([iconX, 0]); }
304
+ // entrada do botão: estoura de zero com quique forte
305
+ mola(kS(btn), tb, [0, 0], [100, 100], { quique: 0.88, dur: 0.75 });
306
+ som(tb, 'pop', 0.8);
307
+ // o cursor entra, o botão afunda e explode
308
+ var tp = tb + 1.05;
309
+ var cur = kCursor(comp, cam.no, u, '#FFFFFF', '#101010');
310
+ var c0 = [bx + bw * 0.5, by + 460 * u], c1 = [bx + bw * 0.4, by + 6 * u]; // clica na borda direita, no ícone da seta (nunca em cima do texto)
311
+ kP(cur).setValue(c0);
312
+ curva(kP(cur), [[tp - 0.75, c0, null, 18], [tp - 0.05, c1, 82, 40]]);
313
+ curva(kO(cur), [[tp - 0.75, 0, null, 30], [tp - 0.55, 100, 60, null], [tp + 0.8, 100, null, 30], [tp + 1.05, 0, 60, null]]);
314
+ curva(kS(cur), [[tp - 0.05, [100, 100], null, 25], [tp + 0.05, [78, 78], 70, 40], [tp + 0.25, [100, 100], 70, null]]);
315
+ curva(kS(btn), [[tp - 0.02, [100, 100], null, 20], [tp + 0.07, [86, 86], 60, 30], [tp + 0.28, [110, 110], 40, 60], [tp + 0.6, [100, 100], 70, null]]);
316
+ // ondas e partículas
317
+ for (j = 0; j < 3; j++) {
318
+ var on = forma(comp, 'pilula', { x: bx, y: by, w: bw, h: bh, traco: j == 1 ? P.fg : P.ac, tracoL: (9 - j * 2) * u, alfa: 0, parent: cam.no, nome: 'onda' });
319
+ curva(kS(on), [[tp + j * 0.07, [100, 100], null, 20], [tp + j * 0.07 + 0.7, [150 + j * 14, 220 + j * 30], 80, null]]);
320
+ curva(kO(on), [[tp + j * 0.07 - 0.02, 0, null, 30], [tp + j * 0.07, 85, null, 30], [tp + j * 0.07 + 0.7, 0, 70, null]]);
321
+ }
322
+ kEstouro(comp, cam, bx, by, tp + 0.04, P.ac, 16, bw * 0.4, false);
323
+ kEstouro(comp, cam, bx, by, tp + 0.08, P.fg, 10, bw * 0.3, false);
324
+ som(tp, 'clique', 0.9); som(tp + 0.03, 'impacto', 0.6); som(tp + 0.1, 'brilho', 0.6);
325
+ // depois do clique o botão respira e solta um halo, sem parar
326
+ var halo = forma(comp, 'pilula', { x: bx, y: by, w: bw, h: bh, traco: P.ac, tracoL: 6 * u, alfa: 0, parent: cam.no, nome: 'halo' });
327
+ kS(halo).expression = 'var q = ((time - ' + (tp + 0.7).toFixed(2) + ') * 0.9) % 1; time < ' + (tp + 0.7).toFixed(2) + ' ? [100, 100] : [100 + 28 * q, 100 + 70 * q]';
328
+ kO(halo).expression = 'var q = ((time - ' + (tp + 0.7).toFixed(2) + ') * 0.9) % 1; time < ' + (tp + 0.7).toFixed(2) + ' ? 0 : 70 * (1 - q)';
329
+ cam.empurra(0.9, 0, 10 * u, 1.02).empurra(tp, 0, 40 * u, 1.06).empurra(comp.duration - 0.2, 0, 60 * u, 1.08);
330
+ fecha(comp);
331
+ }
332
+
333
+ // ---------------------------------------------------------------- montagem
334
+ /* O vocabulário de cenas: 8 clássicas (aqui) + 30 primitivas (primitivas.jsx). O diretor (maquina-diretor.js) escolhe. */
335
+ var CENAS = {
336
+ gancho: cenaGancho, celular: cenaCelular, numero: cenaNumero, lista: cenaLista, antes_depois: cenaAntesDepois, icones: cenaIcones, citacao: cenaCitacao, cta: cenaCta,
337
+ cinetico: cenaCinetico, interface: cenaInterface, mergulho: cenaMergulho, camera_nulls: cenaCameraNulls, barras: cenaBarras, linha: cenaLinha, mapa: cenaMapa,
338
+ cards_pulam: cenaCardsPulam, cursor: cenaCursor, notificacoes: cenaNotificacoes, chat: cenaChat, linha_tempo: cenaLinhaTempo, laco: cenaLaco, explosao: cenaExplosao,
339
+ revela: cenaRevela, split: cenaSplit, heroi: cenaHeroi, particulas: cenaParticulas, relogio: cenaRelogio, calendario: cenaCalendario, funil: cenaFunil,
340
+ parede_logos: cenaParedeLogos, prompt: cenaPrompt, odometro: cenaOdometro, medidor: cenaMedidor, carimbo: cenaCarimbo, leque: cenaLeque, ondas: cenaOndas,
341
+ rolagem: cenaRolagem, estrelas: cenaEstrelas
342
+ };
343
+
344
+ function montar(PL) {
345
+ var W = PL.w, H = PL.h, fps = PL.fps || 30, n = PL.cenas.length, i;
346
+ KIT.fps = fps; KIT.ajuste = PL.ajuste || 1;
347
+ KIT.marca = { titulo: PL.fontes.titulo, destaque: PL.fontes.destaque, texto: PL.fontes.texto };
348
+ KIT.tipo = PL.tipo || {};
349
+ KIT.elementos = PL.elementos || [];
350
+ KIT.voz = PL.voz || null;
351
+ KIT.paletaBase = PL.paleta || null; KIT.debugFit = !!PL.debugFit; KIT.bpm = PL.bpm || 0; KIT.batidaFase = PL.batidaFase || 0; KIT.fx = PL.fx !== false;
352
+ // a câmera dá zoom de até ~10%: o conteúdo é montado a 90% (87% com legenda, subido 7%) para NÃO sair da área segura quando a câmera chega perto
353
+ KIT.enq = 0.88; KIT.enqDy = 0;
354
+ if (PL.legenda && PL.legenda.chunks && PL.legenda.chunks.length) { KIT.enq = 0.85; KIT.enqDy = H * 0.07; }
355
+ var starts = [], t = 0;
356
+ for (i = 0; i < n; i++) { starts.push(PL.cenas[i].inicio != null ? PL.cenas[i].inicio : t); t = starts[i] + PL.cenas[i].dur; }
357
+ var total = PL.duracao || t;
358
+ var main = novaComp('MAIN', W, H, total, fps);
359
+ KIT.main = main;
360
+ // o fundo da MAIN é a cor de destaque: se as duas cenas se afastarem numa troca (chicote, empurra), o vão é uma faixa de cor, nunca preto
361
+ main.layers.addSolid(kCor(PL.paleta && PL.paleta.destaque ? PL.paleta.destaque : '#FFFFFF'), 'fundo-main', W, H, 1);
362
+ // um fundo por cena, embaixo de tudo, com a cor DA CENA: se a câmera ou a troca afastar a cena, a borda mostra a cor dela, não uma faixa de outra cor
363
+ for (i = 0; i < n; i++) { var fb = main.layers.addSolid(kCor(PL.cenas[i].pal.bg), 'fundo-cena ' + i, W, H, 1); fb.inPoint = starts[i]; fb.outPoint = i < n - 1 ? Math.min(total, starts[i + 1] + TROCA_DUR + 0.05) : total; }
364
+ var cam = [];
365
+ for (i = 0; i < n; i++) {
366
+ var c = PL.cenas[i], dur = c.dur + (i < n - 1 ? TROCA_DUR + 0.05 : 0), f = Math.max(1, Math.min(2.4, c.f || 1));
367
+ // a cena é montada em tempo NOMINAL (dur × f) e tocada f vezes mais rápido dentro de uma comp-embrulho: tudo entra nos primeiros ~35%
368
+ var comp = novaComp('CENA ' + i, W, H, dur * f, fps);
369
+ KIT.cenaComElemento = !!c.elemento; KIT.semAmbiente = !!c.semAmbiente || !{ cinetico: 1, gancho: 1, numero: 1, citacao: 1, particulas: 1, odometro: 1, relogio: 1, carimbo: 1 }[c.tipo]; // enfeite só onde há espaço livre de verdade (nada de herói em cima de janela, prompt ou botão) KIT.semRotulos = !!c.semRotulos; KIT.cenaHeroi = c.tipo == 'heroi' || c.tipo == 'revela'; KIT.titulosL = []; KIT.tituloB = null; KIT.t0 = starts[i]; KIT.cenaIdx = i; KIT.estilo = c.camera || PL.camera || 'deriva'; KIT.ajusteCena = c.ajuste || 1; KIT.f = f; KIT.entMax = 0;
370
+ var P = c.pal; KIT.pal = P;
371
+ P.fonteTitulo = PL.fontes.titulo; P.fonteTexto = PL.fontes.texto; P.fonteDestaque = PL.fontes.destaque;
372
+ if (!CENAS[c.tipo]) KIT.avisos.push('cena ' + i + ': tipo desconhecido ' + c.tipo);
373
+ (CENAS[c.tipo] || cenaGancho)(comp, P, c);
374
+ writeLn('ENTRADA ' + JSON.stringify({ cena: i, max: Math.round(kEntradaMax(comp) * 100) / 100, f: f, dur: c.dur }));
375
+ var alvo = comp;
376
+ if (f > 1.001) {
377
+ alvo = novaComp('CENA ' + i + ' T', W, H, dur, fps);
378
+ var R = alvo.layers.add(comp); R.stretch = 100 / f; R.startTime = 0; R.motionBlur = true;
379
+ }
380
+ KIT.f = 1;
381
+ var L = main.layers.add(alvo);
382
+ L.startTime = starts[i];
383
+ L.inPoint = starts[i];
384
+ L.outPoint = i < n - 1 ? Math.min(total, starts[i + 1] + TROCA_DUR + 0.05) : total;
385
+ L.motionBlur = true;
386
+ cam.push(L);
387
+ }
388
+ KIT.t0 = 0; // as trocas usam o tempo do vídeo (o som() soma KIT.t0)
389
+ for (i = 1; i < n; i++) troca(cam[i - 1], cam[i], starts[i], (PL.trocas && PL.trocas[i - 1]) || 'encolhe', PL.cenas[i].pal.ac);
390
+ if (PL.legenda && PL.legenda.chunks && PL.legenda.chunks.length) legenda(main, PL.legenda.chunks, PL.legenda);
391
+ for (i = 0; i < KIT.avisos.length; i++) writeLn('AVISO ' + KIT.avisos[i]);
392
+ writeLn('ELEMENTOS ' + (KIT.nElem || 0));
393
+ writeLn('TOTAL ' + total);
394
+ return main;
395
+ }