@celljs/ta-creator 4.34.0 → 4.35.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.
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/bin/render.mjs +284 -149
- package/host/index.mjs +303 -161
- package/package.json +3 -3
- package/skills/creator-make/SKILL.md +8 -4
- package/web/index.js +691 -27
package/bin/render.mjs
CHANGED
|
@@ -292,12 +292,13 @@ var EpisodeAss;
|
|
|
292
292
|
add(2, start + 0.3, end, "Title", `{\\an5\\pos(${width / 2},${y + Math.round(size2 * 1.2)})\\fs${Math.round(size2 * 0.45)}\\b0\\c&HA3A3A3&\\fad(250,0)}${plain(scene.sub)}`);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
|
|
295
|
+
const listed = scene.points?.length ? scene.points : scene.flow;
|
|
296
|
+
if (listed?.length && !scene.code?.lines.length) {
|
|
296
297
|
const size2 = Math.round((tall ? 50 : 52) * unit);
|
|
297
298
|
const gap = Math.round(size2 * 1.9);
|
|
298
299
|
const first = Math.round(scene.title ? height * (tall ? 0.36 : 0.4) + size2 * 3 : height * (tall ? 0.28 : 0.22));
|
|
299
|
-
const step = (end - start) * 0.7 /
|
|
300
|
-
|
|
300
|
+
const step = (end - start) * 0.7 / listed.length;
|
|
301
|
+
listed.forEach((point, i) => {
|
|
301
302
|
add(2, start + step * i, end, "Point", `{\\an7\\pos(${margin * 2},${first + gap * i})\\fs${size2}\\fad(200,0)}{\\c&H6ACE9E&}${i + 1}{\\c&HFFFFFF&} ${plain(point)}`);
|
|
302
303
|
});
|
|
303
304
|
}
|
|
@@ -446,9 +447,131 @@ var HunyuanVoice;
|
|
|
446
447
|
HunyuanVoice.read = read;
|
|
447
448
|
})(HunyuanVoice ||= {});
|
|
448
449
|
|
|
449
|
-
// web-src/stage.ts
|
|
450
|
-
var
|
|
451
|
-
|
|
450
|
+
// web-src/stage-css.ts
|
|
451
|
+
var STAGE_CSS = `
|
|
452
|
+
*{box-sizing:border-box;margin:0;padding:0}
|
|
453
|
+
body{overflow:hidden;font-family:"PingFang SC","Noto Sans SC","Microsoft YaHei",sans-serif;-webkit-font-smoothing:antialiased}
|
|
454
|
+
.stage{position:absolute;inset:0;overflow:hidden;display:flex;flex-direction:column;--fg:#0A2A1F;--dim:#3d5a4f;color:var(--fg)}
|
|
455
|
+
.paper{background:#F4EFE4}
|
|
456
|
+
.paper:before{content:"";position:absolute;inset:0;background-image:radial-gradient(#d9d1bf .2rem,transparent .2rem);background-size:3.6rem 3.6rem;opacity:.8}
|
|
457
|
+
.ink{background:radial-gradient(120% 90% at 70% 10%,#173b2f 0%,#0d1a16 55%,#0a1210 100%);--fg:#fff;--dim:#bfe9d9}
|
|
458
|
+
.ink:before{content:"";position:absolute;inset:0;background-image:linear-gradient(rgba(16,185,129,.08) 1px,transparent 1px),linear-gradient(90deg,rgba(16,185,129,.08) 1px,transparent 1px);background-size:4.8rem 4.8rem}
|
|
459
|
+
.sketch{background:#FBF6EA;--fg:#222}
|
|
460
|
+
.sketch:before{content:"";position:absolute;inset:0;background:repeating-linear-gradient(transparent 0 4.6rem,#bcd3e8 4.6rem 4.8rem);opacity:.9}
|
|
461
|
+
.sketch:after{content:"";position:absolute;top:0;bottom:0;left:12rem;width:.3rem;background:#e8a0a0}
|
|
462
|
+
.ai{position:absolute;right:3.2rem;top:2.8rem;font-size:2.4rem;color:#fff;background:rgba(0,0,0,.42);padding:.6rem 1.4rem;border-radius:1rem;z-index:20}
|
|
463
|
+
.tall .ai{top:9rem}
|
|
464
|
+
.brand{position:relative;z-index:5;margin:3rem 0 0 4rem;display:flex;align-items:center;gap:1.2rem;font-weight:700;font-size:3rem;color:#0A8F62;height:5rem}
|
|
465
|
+
.tall .brand{margin-top:9.2rem}
|
|
466
|
+
.ink .brand{color:#3ECF8E}
|
|
467
|
+
.brand b{background:#10B981;color:#fff;border-radius:1rem;padding:.4rem 1.2rem;font-size:2.4rem}
|
|
468
|
+
.main{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;gap:5rem;padding:3rem 8rem 15rem}
|
|
469
|
+
.tall .main{flex-direction:column;padding:4rem 6rem 30rem;gap:4rem}
|
|
470
|
+
.post .main{padding-bottom:4rem}
|
|
471
|
+
.words{position:relative;z-index:3;margin:0 6rem 6rem;background:rgba(14,21,18,.86);color:#fff;font-size:4rem;line-height:1.55;font-weight:600;padding:3rem 3.6rem;border-radius:2.4rem}
|
|
472
|
+
.dino{display:block}
|
|
473
|
+
.host{position:relative;flex:none;transition:none}
|
|
474
|
+
.host.up{transform:translateY(-1.2rem)}
|
|
475
|
+
.host .shadow{margin:-1.2rem auto 0;width:70%;height:2rem;border-radius:50%;background:rgba(0,0,0,.18)}
|
|
476
|
+
.ink .host .shadow{background:rgba(0,0,0,.4)}
|
|
477
|
+
.talk{display:flex;flex-direction:column;gap:4rem;align-items:flex-start;max-width:58%}
|
|
478
|
+
.tall .talk{max-width:100%;align-items:center;order:-1}
|
|
479
|
+
.bubble{position:relative;text-wrap:balance;background:#fff;border:.5rem solid #0A2A1F;border-radius:2.6rem;padding:2.4rem 3.2rem;font-size:4.6rem;line-height:1.35;font-weight:700;color:#0A2A1F;box-shadow:.8rem .8rem 0 #0A2A1F}
|
|
480
|
+
.bubble.big{font-size:8.4rem}
|
|
481
|
+
.bubble.soft{background:#E6F7EF;font-size:5rem}
|
|
482
|
+
.wide .talk .bubble:after{content:"";position:absolute;left:-3.2rem;bottom:3rem;border:1.6rem solid transparent;border-right:2.2rem solid #0A2A1F}
|
|
483
|
+
.badge{display:inline-block;background:#F2C14E;color:#0A2A1F;font-weight:800;border-radius:1.6rem;padding:1rem 3rem;border:.5rem solid #0A2A1F;box-shadow:.8rem .8rem 0 #0A2A1F;font-size:6rem}
|
|
484
|
+
.window{position:relative;flex:1;max-width:150rem;align-self:stretch;margin-top:8rem;background:#11161a;border-radius:2.2rem;box-shadow:0 3rem 8rem rgba(0,0,0,.4),0 0 0 .2rem rgba(255,255,255,.06);display:flex;flex-direction:column}
|
|
485
|
+
.tall .window{flex:none;width:100%;margin-top:12rem}
|
|
486
|
+
.window .bar{height:5.6rem;background:#1c2329;border-radius:2.2rem 2.2rem 0 0;display:flex;align-items:center;gap:1.2rem;padding:0 2.2rem;color:#8a99a6;font-size:2.4rem}
|
|
487
|
+
.window .bar i{width:1.6rem;height:1.6rem;border-radius:50%;background:#ff5f57}
|
|
488
|
+
.window .bar i:nth-child(2){background:#febc2e}.window .bar i:nth-child(3){background:#28c840}
|
|
489
|
+
.window .bar span{margin-left:1rem}
|
|
490
|
+
.lines{font-family:Menlo,"JetBrains Mono",monospace;line-height:1.6;color:#d8e1e8;padding:2.8rem 3.4rem;white-space:pre}
|
|
491
|
+
.k-prompt{color:#3ECF8E}.k-comment{color:#6b7b88}.k-string{color:#F2C14E}.k-number{color:#ffaa64}.k-keyword{color:#c792ea}.k-name{color:#7aa2f7}
|
|
492
|
+
.cursor{display:inline-block;width:.55em;height:1.1em;background:#3ECF8E;vertical-align:-.18em;margin-left:.2em}
|
|
493
|
+
.cursor.off{opacity:0}
|
|
494
|
+
.peek{position:absolute;right:6rem;bottom:100%;margin-bottom:-.6rem}
|
|
495
|
+
.wide .scene-code{padding-top:16rem}
|
|
496
|
+
.wide .scene-code .window{margin-top:0;align-self:center}
|
|
497
|
+
.wide .scene-code .note{align-self:center}
|
|
498
|
+
.note{flex:none;width:44rem;text-wrap:balance;background:#10B981;color:#fff;border-radius:2.2rem;padding:3rem;font-size:4.4rem;line-height:1.4;font-weight:700;box-shadow:.8rem .8rem 0 #06281c}
|
|
499
|
+
.paper .note,.sketch .note{box-shadow:.8rem .8rem 0 #0A2A1F;border:.5rem solid #0A2A1F}
|
|
500
|
+
.tall .note{width:100%}
|
|
501
|
+
.phone{position:relative;flex:none;height:calc(100vh - 28rem);aspect-ratio:.56;background:#0b0f12;border-radius:7rem;padding:2.2rem;box-shadow:0 4rem 9rem rgba(0,0,0,.4),inset 0 0 0 .4rem #2a3238}
|
|
502
|
+
.tall .phone{height:auto;width:62%;flex:1;aspect-ratio:auto}
|
|
503
|
+
.screen{position:relative;width:100%;height:100%;border-radius:5.2rem;overflow:hidden;background:#0f1418;display:flex;flex-direction:column}
|
|
504
|
+
.island{position:absolute;left:50%;top:1.8rem;transform:translateX(-50%);width:15rem;height:4.4rem;background:#000;border-radius:2.4rem;z-index:3}
|
|
505
|
+
.screen .lines{flex:1;padding:12rem 2.6rem 0;white-space:pre-wrap;word-break:break-all;color:#cfe}
|
|
506
|
+
.screen.app .lines{font-family:"PingFang SC","Noto Sans SC","Microsoft YaHei",sans-serif;line-height:1.75;color:#e8f2ee;padding-left:3.6rem;padding-right:3.6rem;font-weight:500}
|
|
507
|
+
.home{height:7rem;display:flex;align-items:center;justify-content:center}
|
|
508
|
+
.home:after{content:"";width:16rem;height:.8rem;border-radius:.4rem;background:#55626b}
|
|
509
|
+
.keys{height:11rem;background:#1c2329;display:flex;gap:1rem;align-items:center;justify-content:center;font-family:Menlo,monospace;font-size:2.2rem;color:#cfe}
|
|
510
|
+
.keys span{background:#2d363e;border-radius:1.2rem;padding:.8rem 1.4rem}
|
|
511
|
+
.notify{position:absolute;left:1.8rem;right:1.8rem;top:7rem;background:rgba(245,245,245,.97);border-radius:2.8rem;padding:2rem 2.4rem;display:flex;gap:1.8rem;align-items:center;box-shadow:0 1.4rem 3rem rgba(0,0,0,.35);z-index:4}
|
|
512
|
+
.notify .icon{width:6.4rem;height:6.4rem;border-radius:1.6rem;background:#10B981;flex:none;display:flex;align-items:center;justify-content:center}
|
|
513
|
+
.notify b{font-size:2.6rem;color:#111}.notify p{font-size:2.4rem;color:#444;margin-top:.2rem;line-height:1.35}
|
|
514
|
+
.scene-phone .side,.scene-points .side,.scene-flow .side{display:flex;flex-direction:column;align-items:center;gap:4rem}
|
|
515
|
+
.chart{flex:1;display:flex;flex-direction:column;gap:6rem;min-width:0}
|
|
516
|
+
.tall .chart{flex:none;width:100%}
|
|
517
|
+
.chart h1{font-size:7rem;font-weight:800;line-height:1.2}
|
|
518
|
+
.chain{display:flex;flex-wrap:wrap;align-items:center;gap:2.6rem 1.4rem}
|
|
519
|
+
.chain .step{display:flex;align-items:center;gap:1.4rem;white-space:nowrap}
|
|
520
|
+
.chain .node{background:#fff;color:#0A2A1F;border:.5rem solid #0A2A1F;border-radius:2rem;padding:1.4rem 2.4rem;font-weight:800;line-height:1.3;box-shadow:.6rem .6rem 0 #0A2A1F}
|
|
521
|
+
.chain .node.hub{background:#10B981;color:#fff}
|
|
522
|
+
.chain .node.now{background:#F2C14E;color:#0A2A1F}
|
|
523
|
+
.chain .arrow{font-style:normal;font-weight:900;color:var(--fg)}
|
|
524
|
+
.ink .chain .node{border-color:#06281c;box-shadow:.6rem .6rem 0 #06281c}
|
|
525
|
+
.chart .bubble{align-self:flex-start}
|
|
526
|
+
.tall .scene-flow .side{align-self:flex-end}
|
|
527
|
+
.tall .scene-flow .bubble{font-size:4rem}
|
|
528
|
+
.scene-phone{gap:8rem}
|
|
529
|
+
.tall .scene-phone .side{flex-direction:row;align-items:flex-end;width:100%;justify-content:space-between}
|
|
530
|
+
.tall .scene-phone .bubble{font-size:4rem}
|
|
531
|
+
.hand{filter:url(#wob)}
|
|
532
|
+
.list{flex:1;min-width:0;padding-left:8rem}
|
|
533
|
+
.wide .scene-points .side{max-width:40%}
|
|
534
|
+
.tall .list{padding-left:10rem;flex:none;width:100%}
|
|
535
|
+
.list h1{font-size:8.4rem;color:#1d3b8f;transform:rotate(-2deg);margin-bottom:5rem}
|
|
536
|
+
.list ol{list-style:none;display:flex;flex-direction:column;gap:5rem}
|
|
537
|
+
.list li{position:relative;font-size:6.4rem;font-weight:700;filter:url(#wob)}
|
|
538
|
+
.tall .list li{font-size:5.6rem}
|
|
539
|
+
.list .num{margin-right:1.6rem}
|
|
540
|
+
.list .mark{position:absolute;left:-1rem;bottom:-1.4rem;height:1.8rem;background:#F2C14E;opacity:.6;border-radius:.9rem;z-index:-1}
|
|
541
|
+
.say{font-size:4.6rem;font-weight:700;color:#0A8F62;transform:rotate(4deg);max-width:60rem;line-height:1.3;overflow-wrap:anywhere}
|
|
542
|
+
.opening{align-items:center;justify-content:center}
|
|
543
|
+
.opening .glow{position:absolute;inset:0;background:radial-gradient(circle at 50% 42%,rgba(16,185,129,.38),transparent 45%)}
|
|
544
|
+
.opening .center{position:relative;display:flex;flex-direction:column;align-items:center;gap:3rem;z-index:2}
|
|
545
|
+
.opening h1{font-size:11rem;font-weight:800;color:#fff;letter-spacing:.6rem;text-align:center;line-height:1.2}
|
|
546
|
+
.tall .opening h1{font-size:9rem}
|
|
547
|
+
.opening h1 em{font-style:normal;color:#10B981}
|
|
548
|
+
.opening h2{font-size:4.4rem;color:#9fd9c3;font-weight:600;text-align:center}
|
|
549
|
+
.spark{position:absolute;width:5rem;height:5rem;z-index:1}
|
|
550
|
+
.spark:before,.spark:after{content:"";position:absolute;background:currentColor}
|
|
551
|
+
.spark:before{left:2rem;top:0;width:1rem;height:5rem}.spark:after{top:2rem;left:0;width:5rem;height:1rem}
|
|
552
|
+
.cover{background:#10B981;color:#fff;flex-direction:row}
|
|
553
|
+
.cover .blob{position:absolute;right:-12rem;top:-12rem;width:90rem;height:90rem;border-radius:50%;background:#0FA372}
|
|
554
|
+
.tall .cover .blob{right:auto;left:-20rem;top:auto;bottom:-26rem}
|
|
555
|
+
.cover .text{position:relative;z-index:2;padding:8rem 0 0 9rem;width:62%}
|
|
556
|
+
.tall .cover .text{width:100%;padding:9rem 7rem 0}
|
|
557
|
+
.cover .tag{display:inline-block;font-size:4rem;font-weight:800;color:#06281c;background:#F2C14E;padding:1rem 2.6rem;border-radius:1.6rem;border:.5rem solid #06281c;box-shadow:.7rem .7rem 0 #06281c}
|
|
558
|
+
.cover h1{margin-top:5rem;line-height:1.12;font-weight:800;text-shadow:.8rem .8rem 0 #06281c}
|
|
559
|
+
.cover h2{margin-top:4rem;font-size:5.6rem;font-weight:800;color:#06281c}
|
|
560
|
+
.cover .tags{margin-top:5rem;display:flex;gap:1.8rem;flex-wrap:wrap}
|
|
561
|
+
.cover .tags span{background:#06281c;font-size:4rem;font-weight:700;padding:1rem 2.6rem;border-radius:99rem}
|
|
562
|
+
.cover .props{position:absolute;inset:0;z-index:1}
|
|
563
|
+
.cover .phone.mini{position:absolute;height:auto;width:33rem;aspect-ratio:.49;right:17rem;bottom:10rem;transform:rotate(8deg);padding:1.6rem;border-radius:5rem}
|
|
564
|
+
.tall .cover .phone.mini{width:38rem;right:6rem;bottom:-4rem}
|
|
565
|
+
.cover .phone.mini .screen{border-radius:3.8rem}
|
|
566
|
+
.cover .phone.mini .island{width:10rem;height:3rem}
|
|
567
|
+
.cover .phone.mini .notify{top:6rem;padding:1.4rem}
|
|
568
|
+
.cover .phone.mini .icon{width:5rem;height:5rem}
|
|
569
|
+
.cover .host{position:absolute;right:42rem;bottom:6rem;filter:drop-shadow(.6rem 0 0 #06281c) drop-shadow(-.6rem 0 0 #06281c) drop-shadow(0 .6rem 0 #06281c) drop-shadow(0 -.6rem 0 #06281c) drop-shadow(1rem 1.2rem 0 rgba(6,40,28,.35))}
|
|
570
|
+
.tall .cover .host{right:auto;left:8rem;bottom:8rem}
|
|
571
|
+
`;
|
|
572
|
+
var SKETCH = '<svg width="0" height="0" style="position:absolute"><filter id="wob"><feTurbulence baseFrequency=".03" numOctaves="2" seed="3"/><feDisplacementMap in="SourceGraphic" scale="6"/></filter></svg>';
|
|
573
|
+
|
|
574
|
+
// web-src/stage-dino.ts
|
|
452
575
|
var BODY = [
|
|
453
576
|
"..........####......",
|
|
454
577
|
"........##########..",
|
|
@@ -531,6 +654,35 @@ var EYES = {
|
|
|
531
654
|
]
|
|
532
655
|
}
|
|
533
656
|
};
|
|
657
|
+
|
|
658
|
+
// web-src/stage-motion.ts
|
|
659
|
+
var FPS = 30;
|
|
660
|
+
var FADE = 0.4;
|
|
661
|
+
var POP = 0.35;
|
|
662
|
+
var TYPING = 36;
|
|
663
|
+
function ease(t) {
|
|
664
|
+
return 1 - (1 - t) ** 3;
|
|
665
|
+
}
|
|
666
|
+
function arriving(enter, x = 0, y = 0, grow = 0) {
|
|
667
|
+
if (enter >= 1) {
|
|
668
|
+
return "";
|
|
669
|
+
}
|
|
670
|
+
const e = ease(enter);
|
|
671
|
+
const scale = grow ? ` scale(${(1 - grow * (1 - e)).toFixed(3)})` : "";
|
|
672
|
+
return ` style="opacity:${e.toFixed(3)};transform:translate(${(x * (1 - e)).toFixed(2)}rem,${(y * (1 - e)).toFixed(2)}rem)${scale}"`;
|
|
673
|
+
}
|
|
674
|
+
function typed(lines, step, enter) {
|
|
675
|
+
const shown = lines.slice(0, Math.min(step, lines.length));
|
|
676
|
+
if (enter < 1 && step >= 1 && step <= lines.length) {
|
|
677
|
+
const chars = Array.from(shown[shown.length - 1]);
|
|
678
|
+
shown[shown.length - 1] = chars.slice(0, Math.ceil(enter * chars.length)).join("");
|
|
679
|
+
}
|
|
680
|
+
return shown;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// web-src/stage.ts
|
|
684
|
+
var BEAT = 0.5;
|
|
685
|
+
var OPENING = 2.2;
|
|
534
686
|
var GREEN = "#10B981";
|
|
535
687
|
var SHADE = "#0A8F62";
|
|
536
688
|
var EpisodeStage;
|
|
@@ -587,7 +739,7 @@ var EpisodeStage;
|
|
|
587
739
|
}
|
|
588
740
|
EpisodeStage.code = code;
|
|
589
741
|
function kind(scene) {
|
|
590
|
-
return scene.phone?.lines.length ? "phone" : scene.code?.lines.length ? "code" : scene.points?.length ? "points" : "title";
|
|
742
|
+
return scene.phone?.lines.length ? "phone" : scene.code?.lines.length ? "code" : scene.points?.length ? "points" : scene.flow?.length ? "flow" : "title";
|
|
591
743
|
}
|
|
592
744
|
EpisodeStage.kind = kind;
|
|
593
745
|
function last(scene) {
|
|
@@ -598,6 +750,8 @@ var EpisodeStage;
|
|
|
598
750
|
return scene.code?.lines.length ?? 0;
|
|
599
751
|
case "points":
|
|
600
752
|
return scene.points?.length ?? 0;
|
|
753
|
+
case "flow":
|
|
754
|
+
return scene.flow?.length ?? 0;
|
|
601
755
|
default:
|
|
602
756
|
return scene.sub ? 1 : 0;
|
|
603
757
|
}
|
|
@@ -609,10 +763,11 @@ var EpisodeStage;
|
|
|
609
763
|
case "code":
|
|
610
764
|
case "phone": {
|
|
611
765
|
const lines = (scene.phone ?? scene.code)?.lines.length ?? 1;
|
|
612
|
-
const
|
|
613
|
-
return end > lines ? [...
|
|
766
|
+
const typed2 = Array.from({ length: lines }, (_, i) => (kind(scene) === "code" ? 0.6 : 0.5) * (i / lines));
|
|
767
|
+
return end > lines ? [...typed2, 0.7] : typed2;
|
|
614
768
|
}
|
|
615
769
|
case "points":
|
|
770
|
+
case "flow":
|
|
616
771
|
return Array.from({ length: end }, (_, i) => 0.7 * (i / end));
|
|
617
772
|
default:
|
|
618
773
|
return end ? [0, 0.12] : [0];
|
|
@@ -623,6 +778,15 @@ var EpisodeStage;
|
|
|
623
778
|
return kind(scene) === "title" ? 0 : 1;
|
|
624
779
|
}
|
|
625
780
|
EpisodeStage.first = first;
|
|
781
|
+
function entering(scene, step) {
|
|
782
|
+
const what = kind(scene);
|
|
783
|
+
const lines = (what === "code" ? scene.code?.lines : what === "phone" ? scene.phone?.lines : undefined) ?? [];
|
|
784
|
+
if (step >= 1 && step <= lines.length) {
|
|
785
|
+
return Math.min(1.2, EpisodeAss.columns(lines[step - 1]) / TYPING);
|
|
786
|
+
}
|
|
787
|
+
return what === "title" && step === 0 && !scene.title ? 0 : POP;
|
|
788
|
+
}
|
|
789
|
+
EpisodeStage.entering = entering;
|
|
626
790
|
function timeline(timed, opening2 = 0) {
|
|
627
791
|
const out = [];
|
|
628
792
|
const hold = (scene, step, from, to) => {
|
|
@@ -630,6 +794,23 @@ var EpisodeStage;
|
|
|
630
794
|
out.push({ shot: { scene, step, pose }, seconds: Math.min(BEAT, to - at) });
|
|
631
795
|
}
|
|
632
796
|
};
|
|
797
|
+
const move = (scene, step, from, to, start, enter) => {
|
|
798
|
+
const fade = scene > 0 || opening2 ? FADE : 0;
|
|
799
|
+
const until = Math.min(to, Math.max(from + enter, start + fade));
|
|
800
|
+
const count = Math.max(0, Math.round((until - from) * FPS));
|
|
801
|
+
let at = from;
|
|
802
|
+
for (let n = 0;n < count; n++, at = from + n / FPS) {
|
|
803
|
+
const shot = { scene, step, pose: 0 };
|
|
804
|
+
if (enter && at - from < enter) {
|
|
805
|
+
shot.enter = (at - from) / enter;
|
|
806
|
+
}
|
|
807
|
+
if (fade && at - start < fade) {
|
|
808
|
+
shot.into = (at - start) / fade;
|
|
809
|
+
}
|
|
810
|
+
out.push({ shot, seconds: Math.min(1 / FPS, to - at) });
|
|
811
|
+
}
|
|
812
|
+
hold(scene, step, Math.min(to, from + count / FPS), to);
|
|
813
|
+
};
|
|
633
814
|
if (opening2) {
|
|
634
815
|
hold(-1, 0, 0, opening2);
|
|
635
816
|
}
|
|
@@ -637,7 +818,7 @@ var EpisodeStage;
|
|
|
637
818
|
const at = steps(scene).map((share) => start + share * (end - start));
|
|
638
819
|
const base = first(scene);
|
|
639
820
|
for (const [k, from] of at.entries()) {
|
|
640
|
-
|
|
821
|
+
move(i, base + k, from, at[k + 1] ?? end, start, entering(scene, base + k));
|
|
641
822
|
}
|
|
642
823
|
});
|
|
643
824
|
return out;
|
|
@@ -646,7 +827,7 @@ var EpisodeStage;
|
|
|
646
827
|
function page(aspect) {
|
|
647
828
|
const [width, height] = EpisodeAss.size(aspect);
|
|
648
829
|
const rem = Math.min(width, height) / 1080 * 10;
|
|
649
|
-
return '<!doctype html><html><head><meta charset="utf-8"><style>html{font-size:' + rem + "px}" +
|
|
830
|
+
return '<!doctype html><html><head><meta charset="utf-8"><style>html{font-size:' + rem + "px}" + STAGE_CSS + '</style></head><body class="' + (width > height ? "wide" : "tall") + '" style="width:' + width + "px;height:" + height + 'px"></body></html>';
|
|
650
831
|
}
|
|
651
832
|
EpisodeStage.page = page;
|
|
652
833
|
function frame(episode, shot, aspect, options = {}) {
|
|
@@ -660,9 +841,17 @@ var EpisodeStage;
|
|
|
660
841
|
const what = kind(scene);
|
|
661
842
|
const look = scene.look ?? episode.look ?? (what === "code" ? "ink" : what === "points" ? "sketch" : "paper");
|
|
662
843
|
const step = Math.min(shot.step, last(scene));
|
|
663
|
-
const
|
|
844
|
+
const enter = Math.min(1, Math.max(0, shot.enter ?? 1));
|
|
845
|
+
const body = what === "code" ? terminal(scene, step, shot.pose, wide, enter) : what === "phone" ? phone(scene, step, shot.pose, wide, enter) : what === "points" ? points(scene, step, shot.pose, wide, enter) : what === "flow" ? flow(scene, step, shot.pose, wide) : host(scene, step, shot.pose, wide, enter);
|
|
664
846
|
const words = options.post ? `<div class="words">${html(scene.say)}</div>` : "";
|
|
665
|
-
|
|
847
|
+
const into = ease(Math.min(1, Math.max(0, shot.into ?? 1)));
|
|
848
|
+
const drawn = '<div class="stage ' + look + (options.post ? " post" : "") + '"' + (into < 1 ? ` style="opacity:${into.toFixed(3)}"` : "") + ">" + SKETCH + label + brand(episode) + '<div class="main scene-' + what + '"' + (into < 1 ? ` style="transform:translateY(${((1 - into) * 6).toFixed(2)}rem)"` : "") + ">" + body + "</div>" + words + "</div>";
|
|
849
|
+
if (into >= 1) {
|
|
850
|
+
return drawn;
|
|
851
|
+
}
|
|
852
|
+
const before = episode.scenes[shot.scene - 1];
|
|
853
|
+
const under = before ? { scene: shot.scene - 1, step: last(before), pose: 0 } : { scene: -1, step: 0, pose: 0 };
|
|
854
|
+
return frame(episode, under, aspect, options) + drawn;
|
|
666
855
|
}
|
|
667
856
|
EpisodeStage.frame = frame;
|
|
668
857
|
function cover(episode, aspect) {
|
|
@@ -677,7 +866,7 @@ var EpisodeStage;
|
|
|
677
866
|
const tag = episode.series ? `<div class="tag">${html(episode.series.split(/\s*[·•]\s*/)[0])}${episode.number ? ` · 第 ${episode.number} 期` : ""}</div>` : "";
|
|
678
867
|
const notify = episode.scenes.find((one) => one.phone?.notify)?.phone?.notify;
|
|
679
868
|
const tags = (episode.cover?.tags ?? []).slice(0, 4).map((one) => `<span>${html(one)}</span>`).join("");
|
|
680
|
-
return '<div class="stage cover"
|
|
869
|
+
return '<div class="stage cover"><div class="blob"></div><div class="text">' + tag + '<h1 style="font-size:' + size.toFixed(2) + 'rem">' + lines.map(html).join("<br>") + "</h1>" + (sub ? `<h2>${html(sub)}</h2>` : "") + (tags ? `<div class="tags">${tags}</div>` : "") + '</div><div class="props">' + (notify ? '<div class="phone mini"><div class="screen"><div class="island"></div><div class="notify"><div class="icon">' + dino(3.6, { eyes: "happy" }, true) + "</div><div><b>" + html(notify.title) + "</b><p>" + html(notify.text) + "</p></div></div></div></div>" : "") + '<div class="host">' + dino(wide ? 44 : 46, { arms: "out", eyes: "happy" }, true) + "</div></div></div>";
|
|
681
870
|
}
|
|
682
871
|
EpisodeStage.cover = cover;
|
|
683
872
|
function brand(episode) {
|
|
@@ -699,156 +888,71 @@ var EpisodeStage;
|
|
|
699
888
|
return '<div class="glow"></div>' + sparks + '<div class="center"><div class="jump"' + jump + ">" + dino(wide ? 36 : 44, { arms: "up", eyes: "happy", legs: shot.pose ? "tuck" : "stand" }) + "</div><h1>" + html(name).replace(/\s*[·•]\s*/, "<em> · </em>") + "</h1>" + (sub ? `<h2>${html(sub)}</h2>` : "") + "</div>";
|
|
700
889
|
}
|
|
701
890
|
const STEP = /^(第.{1,3}[步招点个]|窍门.{1,2}|技巧.{1,2}|步骤.{1,2}|Step \d+|Tip \d+)$/i;
|
|
702
|
-
function host(scene, step, pose, wide) {
|
|
891
|
+
function host(scene, step, pose, wide, enter = 1) {
|
|
703
892
|
const title = scene.title ?? "";
|
|
704
893
|
const badge = STEP.test(title);
|
|
705
|
-
const
|
|
706
|
-
const
|
|
894
|
+
const pop = (at) => step === at ? arriving(enter, 0, 2, 0.12) : "";
|
|
895
|
+
const first2 = badge ? `<div class="badge big"${pop(0)}>${html(title)}</div>` : `<div class="bubble big"${pop(0)}>${html(title)}</div>`;
|
|
896
|
+
const second = scene.sub && step >= 1 ? `<div class="bubble${badge ? " big" : " soft"}"${pop(1)}>${html(scene.sub)}</div>` : "";
|
|
707
897
|
const dinoPose = pose ? { arms: "out", eyes: "happy" } : { arms: "down", eyes: "n" };
|
|
708
898
|
return '<div class="host' + (pose ? " up" : "") + '">' + dino(wide ? 50 : 54, dinoPose) + '<div class="shadow"></div></div><div class="talk">' + first2 + second + "</div>";
|
|
709
899
|
}
|
|
710
|
-
function terminal(scene, step, pose, wide) {
|
|
900
|
+
function terminal(scene, step, pose, wide, enter = 1) {
|
|
711
901
|
const lines = (scene.code?.lines ?? []).slice(0, wide ? 14 : 22);
|
|
712
|
-
const shown = lines
|
|
902
|
+
const shown = typed(lines, step, enter);
|
|
713
903
|
const longest = Math.max(24, ...lines.map(EpisodeAss.columns));
|
|
714
904
|
const room = wide ? scene.note ? 118 : 150 : 96;
|
|
715
|
-
const size = Math.max(2.2, Math.min(wide ? 4 :
|
|
716
|
-
const typing = step < lines.length;
|
|
905
|
+
const size = Math.max(2.2, Math.min(wide ? Math.min(4, 62 / (lines.length * 1.6)) : 4.4, room / (longest * 0.6)));
|
|
906
|
+
const typing = step < lines.length || enter < 1;
|
|
717
907
|
const rows = shown.map((line, i) => `<div>${code(line)}${i === shown.length - 1 ? `<span class="cursor${typing || pose ? "" : " off"}"></span>` : ""}</div>`).join("");
|
|
718
|
-
const note = scene.note ? `<div class="note">${html(scene.note)}</div>` : "";
|
|
719
908
|
const peek = `<div class="peek">${dino(wide ? 20 : 14, { eyes: pose ? "d" : "l", legs: "none" })}</div>`;
|
|
720
|
-
return '<div class="window">' + peek + '<div class="bar"><i></i><i></i><i></i><span>' + html(scene.code?.file ?? "zsh") + '</span></div><div class="lines" style="font-size:' + size.toFixed(2) +
|
|
909
|
+
return '<div class="window">' + peek + '<div class="bar"><i></i><i></i><i></i><span>' + html(scene.code?.file ?? "zsh") + '</span></div><div class="lines" style="font-size:' + size.toFixed(2) + "rem;min-height:calc(" + (lines.length * 1.6).toFixed(1) + 'em + 5.6rem)">' + rows + "</div></div>" + (scene.note ? `<div class="note"${step === 1 ? arriving(enter, 3) : ""}>${html(scene.note)}</div>` : "");
|
|
721
910
|
}
|
|
722
|
-
function phone(scene, step, pose, wide) {
|
|
911
|
+
function phone(scene, step, pose, wide, enter = 1) {
|
|
723
912
|
const lines = (scene.phone?.lines ?? []).slice(0, 16);
|
|
724
|
-
const shown = lines
|
|
913
|
+
const shown = typed(lines, step, enter);
|
|
725
914
|
const notified = scene.phone?.notify && step > lines.length;
|
|
726
|
-
const
|
|
727
|
-
const
|
|
728
|
-
const
|
|
729
|
-
const
|
|
915
|
+
const coming = notified && enter < 1 ? ease(enter) : 1;
|
|
916
|
+
const shell = lines.some((line) => /^\s*\$ /.test(line));
|
|
917
|
+
const longest = Math.max(18, ...lines.map(EpisodeAss.columns));
|
|
918
|
+
const size = Math.max(1.8, Math.min(wide ? 3.4 : 4.4, (wide ? 38 : 54) / (longest * (shell ? 0.6 : 0.52))));
|
|
919
|
+
const rows = shown.map((line, i) => `<div>${shell ? code(line) : html(line) || " "}${shell && i === shown.length - 1 && !notified ? '<span class="cursor"></span>' : ""}</div>`).join("");
|
|
920
|
+
const notify = notified ? '<div class="notify"' + (coming < 1 ? ` style="opacity:${coming.toFixed(3)};transform:translateY(${(-(1 - coming) * 12).toFixed(2)}rem)"` : "") + '><div class="icon">' + dino(4.6, { eyes: "happy" }, true) + "</div><div><b>" + html(scene.phone?.notify?.title ?? "") + " · 刚刚</b><p>" + html(scene.phone?.notify?.text ?? "") + "</p></div></div>" : "";
|
|
730
921
|
const note = scene.note ? `<div class="bubble">${html(scene.note)}</div>` : "";
|
|
731
922
|
const dinoPose = notified ? { arms: "up", eyes: "happy" } : pose ? { arms: "out", eyes: "n" } : { arms: "down", eyes: "d" };
|
|
732
|
-
return '<div class="side">' + note + '<div class="host' + (pose ? " up" : "") + '">' + dino(wide ? 40 : 22, dinoPose) + '<div class="shadow"></div></div></div><div class="phone"><div class="screen' + (
|
|
923
|
+
return '<div class="side">' + note + '<div class="host' + (pose ? " up" : "") + '">' + dino(wide ? 40 : 22, dinoPose) + '<div class="shadow"></div></div></div><div class="phone"><div class="screen' + (shell ? "" : " app") + '"><div class="island"></div>' + notify + '<div class="lines" style="font-size:' + size.toFixed(2) + "rem;padding-top:" + (12 + (notified ? 10 * coming : 0)).toFixed(2) + 'rem">' + rows + "</div>" + (shell ? '<div class="keys"><span>esc</span><span>tab</span><span>ctrl</span><span>↑</span><span>↓</span></div>' : '<div class="home"></div>') + "</div></div>";
|
|
733
924
|
}
|
|
734
|
-
function points(scene, step, pose, wide) {
|
|
735
|
-
const items = (scene.points ?? []).slice(0, step).map((one, i) =>
|
|
925
|
+
function points(scene, step, pose, wide, enter = 1) {
|
|
926
|
+
const items = (scene.points ?? []).slice(0, step).map((one, i) => {
|
|
927
|
+
const newest = i === step - 1 && enter < 1;
|
|
928
|
+
return "<li" + (newest ? arriving(Math.min(1, enter * 1.6), -4) : "") + '><span class="num">' + "①②③④⑤⑥⑦⑧⑨"[i] + "</span>" + html(one) + '<i class="mark" style="width:' + ((60 + i * 13 % 30) * (newest ? ease(enter) : 1)).toFixed(1) + '%"></i></li>';
|
|
929
|
+
}).join("");
|
|
736
930
|
const done = step >= (scene.points?.length ?? 0);
|
|
737
931
|
const dinoPose = done ? { arms: "up", eyes: "happy" } : pose ? { arms: "out", eyes: "n" } : { arms: "down", eyes: "d" };
|
|
738
932
|
return '<div class="list"><h1 class="hand">' + html(scene.title ?? "") + "</h1><ol>" + items + '</ol></div><div class="side">' + (scene.sub && done ? `<div class="hand say">${html(scene.sub)}</div>` : "") + '<div class="host hand' + (pose ? " up" : "") + '">' + dino(wide ? 36 : 26, dinoPose) + '<div class="shadow"></div></div></div>';
|
|
739
933
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
.
|
|
745
|
-
|
|
746
|
-
.
|
|
747
|
-
.
|
|
748
|
-
.
|
|
749
|
-
.
|
|
750
|
-
|
|
751
|
-
.
|
|
752
|
-
|
|
753
|
-
.
|
|
754
|
-
|
|
755
|
-
.tall .brand{margin-top:9.2rem}
|
|
756
|
-
.ink .brand{color:#3ECF8E}
|
|
757
|
-
.brand b{background:#10B981;color:#fff;border-radius:1rem;padding:.4rem 1.2rem;font-size:2.4rem}
|
|
758
|
-
.main{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;gap:5rem;padding:3rem 8rem 15rem}
|
|
759
|
-
.tall .main{flex-direction:column;padding:4rem 6rem 30rem;gap:4rem}
|
|
760
|
-
.post .main{padding-bottom:4rem}
|
|
761
|
-
.words{position:relative;z-index:3;margin:0 6rem 6rem;background:rgba(14,21,18,.86);color:#fff;font-size:4rem;line-height:1.55;font-weight:600;padding:3rem 3.6rem;border-radius:2.4rem}
|
|
762
|
-
.dino{display:block}
|
|
763
|
-
.host{position:relative;flex:none;transition:none}
|
|
764
|
-
.host.up{transform:translateY(-1.2rem)}
|
|
765
|
-
.host .shadow{margin:-1.2rem auto 0;width:70%;height:2rem;border-radius:50%;background:rgba(0,0,0,.18)}
|
|
766
|
-
.ink .host .shadow{background:rgba(0,0,0,.4)}
|
|
767
|
-
.talk{display:flex;flex-direction:column;gap:4rem;align-items:flex-start;max-width:58%}
|
|
768
|
-
.tall .talk{max-width:100%;align-items:center;order:-1}
|
|
769
|
-
.bubble{position:relative;background:#fff;border:.5rem solid #0A2A1F;border-radius:2.6rem;padding:2.4rem 3.2rem;font-size:4.6rem;line-height:1.35;font-weight:700;color:#0A2A1F;box-shadow:.8rem .8rem 0 #0A2A1F}
|
|
770
|
-
.bubble.big{font-size:8.4rem}
|
|
771
|
-
.bubble.soft{background:#E6F7EF;font-size:5rem}
|
|
772
|
-
.wide .talk .bubble:after{content:"";position:absolute;left:-3.2rem;bottom:3rem;border:1.6rem solid transparent;border-right:2.2rem solid #0A2A1F}
|
|
773
|
-
.badge{display:inline-block;background:#F2C14E;color:#0A2A1F;font-weight:800;border-radius:1.6rem;padding:1rem 3rem;border:.5rem solid #0A2A1F;box-shadow:.8rem .8rem 0 #0A2A1F;font-size:6rem}
|
|
774
|
-
.window{position:relative;flex:1;max-width:150rem;align-self:stretch;margin-top:8rem;background:#11161a;border-radius:2.2rem;box-shadow:0 3rem 8rem rgba(0,0,0,.4),0 0 0 .2rem rgba(255,255,255,.06);display:flex;flex-direction:column}
|
|
775
|
-
.tall .window{flex:none;width:100%;margin-top:12rem;min-height:60%}
|
|
776
|
-
.window .bar{height:5.6rem;background:#1c2329;border-radius:2.2rem 2.2rem 0 0;display:flex;align-items:center;gap:1.2rem;padding:0 2.2rem;color:#8a99a6;font-size:2.4rem}
|
|
777
|
-
.window .bar i{width:1.6rem;height:1.6rem;border-radius:50%;background:#ff5f57}
|
|
778
|
-
.window .bar i:nth-child(2){background:#febc2e}.window .bar i:nth-child(3){background:#28c840}
|
|
779
|
-
.window .bar span{margin-left:1rem}
|
|
780
|
-
.lines{font-family:Menlo,"JetBrains Mono",monospace;line-height:1.6;color:#d8e1e8;padding:2.8rem 3.4rem;white-space:pre}
|
|
781
|
-
.k-prompt{color:#3ECF8E}.k-comment{color:#6b7b88}.k-string{color:#F2C14E}.k-number{color:#ffaa64}.k-keyword{color:#c792ea}.k-name{color:#7aa2f7}
|
|
782
|
-
.cursor{display:inline-block;width:.55em;height:1.1em;background:#3ECF8E;vertical-align:-.18em;margin-left:.2em}
|
|
783
|
-
.cursor.off{opacity:0}
|
|
784
|
-
.peek{position:absolute;right:6rem;bottom:100%;margin-bottom:-.6rem}
|
|
785
|
-
.wide .scene-code{align-items:stretch;padding-top:16rem}
|
|
786
|
-
.wide .scene-code .window{margin-top:0}
|
|
787
|
-
.wide .scene-code .note{align-self:center}
|
|
788
|
-
.screen.notified .lines{padding-top:22rem}
|
|
789
|
-
.note{flex:none;width:44rem;background:#10B981;color:#fff;border-radius:2.2rem;padding:3rem;font-size:4.4rem;line-height:1.4;font-weight:700;box-shadow:.8rem .8rem 0 #06281c}
|
|
790
|
-
.paper .note,.sketch .note{box-shadow:.8rem .8rem 0 #0A2A1F;border:.5rem solid #0A2A1F}
|
|
791
|
-
.tall .note{width:100%}
|
|
792
|
-
.phone{position:relative;flex:none;height:calc(100vh - 28rem);aspect-ratio:.56;background:#0b0f12;border-radius:7rem;padding:2.2rem;box-shadow:0 4rem 9rem rgba(0,0,0,.4),inset 0 0 0 .4rem #2a3238}
|
|
793
|
-
.tall .phone{height:auto;width:62%;flex:1;aspect-ratio:auto}
|
|
794
|
-
.screen{position:relative;width:100%;height:100%;border-radius:5.2rem;overflow:hidden;background:#0f1418;display:flex;flex-direction:column}
|
|
795
|
-
.island{position:absolute;left:50%;top:1.8rem;transform:translateX(-50%);width:15rem;height:4.4rem;background:#000;border-radius:2.4rem;z-index:3}
|
|
796
|
-
.screen .lines{flex:1;padding:12rem 2.6rem 0;white-space:pre-wrap;word-break:break-all;color:#cfe}
|
|
797
|
-
.keys{height:11rem;background:#1c2329;display:flex;gap:1rem;align-items:center;justify-content:center;font-family:Menlo,monospace;font-size:2.2rem;color:#cfe}
|
|
798
|
-
.keys span{background:#2d363e;border-radius:1.2rem;padding:.8rem 1.4rem}
|
|
799
|
-
.notify{position:absolute;left:1.8rem;right:1.8rem;top:7rem;background:rgba(245,245,245,.97);border-radius:2.8rem;padding:2rem 2.4rem;display:flex;gap:1.8rem;align-items:center;box-shadow:0 1.4rem 3rem rgba(0,0,0,.35);z-index:4}
|
|
800
|
-
.notify .icon{width:6.4rem;height:6.4rem;border-radius:1.6rem;background:#10B981;flex:none;display:flex;align-items:center;justify-content:center}
|
|
801
|
-
.notify b{font-size:2.6rem;color:#111}.notify p{font-size:2.4rem;color:#444;margin-top:.2rem;line-height:1.35}
|
|
802
|
-
.scene-phone .side,.scene-points .side{display:flex;flex-direction:column;align-items:center;gap:4rem}
|
|
803
|
-
.scene-phone{gap:8rem}
|
|
804
|
-
.tall .scene-phone .side{flex-direction:row;align-items:flex-end;width:100%;justify-content:space-between}
|
|
805
|
-
.tall .scene-phone .bubble{font-size:4rem}
|
|
806
|
-
.hand{filter:url(#wob)}
|
|
807
|
-
.list{flex:1;padding-left:8rem}
|
|
808
|
-
.tall .list{padding-left:10rem;flex:none;width:100%}
|
|
809
|
-
.list h1{font-size:8.4rem;color:#1d3b8f;transform:rotate(-2deg);margin-bottom:5rem}
|
|
810
|
-
.list ol{list-style:none;display:flex;flex-direction:column;gap:5rem}
|
|
811
|
-
.list li{position:relative;font-size:6.4rem;font-weight:700;filter:url(#wob)}
|
|
812
|
-
.tall .list li{font-size:5.6rem}
|
|
813
|
-
.list .num{margin-right:1.6rem}
|
|
814
|
-
.list .mark{position:absolute;left:-1rem;bottom:-1.4rem;height:1.8rem;background:#F2C14E;opacity:.6;border-radius:.9rem;z-index:-1}
|
|
815
|
-
.say{font-size:4.6rem;font-weight:700;color:#0A8F62;transform:rotate(4deg)}
|
|
816
|
-
.opening{align-items:center;justify-content:center}
|
|
817
|
-
.opening .glow{position:absolute;inset:0;background:radial-gradient(circle at 50% 42%,rgba(16,185,129,.38),transparent 45%)}
|
|
818
|
-
.opening .center{position:relative;display:flex;flex-direction:column;align-items:center;gap:3rem;z-index:2}
|
|
819
|
-
.opening h1{font-size:11rem;font-weight:800;color:#fff;letter-spacing:.6rem;text-align:center;line-height:1.2}
|
|
820
|
-
.tall .opening h1{font-size:9rem}
|
|
821
|
-
.opening h1 em{font-style:normal;color:#10B981}
|
|
822
|
-
.opening h2{font-size:4.4rem;color:#9fd9c3;font-weight:600;text-align:center}
|
|
823
|
-
.spark{position:absolute;width:5rem;height:5rem;z-index:1}
|
|
824
|
-
.spark:before,.spark:after{content:"";position:absolute;background:currentColor}
|
|
825
|
-
.spark:before{left:2rem;top:0;width:1rem;height:5rem}.spark:after{top:2rem;left:0;width:5rem;height:1rem}
|
|
826
|
-
.cover{background:#10B981;color:#fff;flex-direction:row}
|
|
827
|
-
.cover .blob{position:absolute;right:-12rem;top:-12rem;width:90rem;height:90rem;border-radius:50%;background:#0FA372}
|
|
828
|
-
.tall .cover .blob{right:auto;left:-20rem;top:auto;bottom:-26rem}
|
|
829
|
-
.cover .text{position:relative;z-index:2;padding:8rem 0 0 9rem;width:62%}
|
|
830
|
-
.tall .cover .text{width:100%;padding:9rem 7rem 0}
|
|
831
|
-
.cover .tag{display:inline-block;font-size:4rem;font-weight:800;color:#06281c;background:#F2C14E;padding:1rem 2.6rem;border-radius:1.6rem;border:.5rem solid #06281c;box-shadow:.7rem .7rem 0 #06281c}
|
|
832
|
-
.cover h1{margin-top:5rem;line-height:1.12;font-weight:800;text-shadow:.8rem .8rem 0 #06281c}
|
|
833
|
-
.cover h2{margin-top:4rem;font-size:5.6rem;font-weight:800;color:#06281c}
|
|
834
|
-
.cover .tags{margin-top:5rem;display:flex;gap:1.8rem;flex-wrap:wrap}
|
|
835
|
-
.cover .tags span{background:#06281c;font-size:4rem;font-weight:700;padding:1rem 2.6rem;border-radius:99rem}
|
|
836
|
-
.cover .props{position:absolute;inset:0;z-index:1}
|
|
837
|
-
.cover .phone.mini{position:absolute;height:auto;width:33rem;aspect-ratio:.49;right:17rem;bottom:10rem;transform:rotate(8deg);padding:1.6rem;border-radius:5rem}
|
|
838
|
-
.tall .cover .phone.mini{width:38rem;right:6rem;bottom:-4rem}
|
|
839
|
-
.cover .phone.mini .screen{border-radius:3.8rem}
|
|
840
|
-
.cover .phone.mini .island{width:10rem;height:3rem}
|
|
841
|
-
.cover .phone.mini .notify{top:6rem;padding:1.4rem}
|
|
842
|
-
.cover .phone.mini .icon{width:5rem;height:5rem}
|
|
843
|
-
.cover .host{position:absolute;right:42rem;bottom:6rem;filter:drop-shadow(.6rem 0 0 #06281c) drop-shadow(-.6rem 0 0 #06281c) drop-shadow(0 .6rem 0 #06281c) drop-shadow(0 -.6rem 0 #06281c) drop-shadow(1rem 1.2rem 0 rgba(6,40,28,.35))}
|
|
844
|
-
.tall .cover .host{right:auto;left:8rem;bottom:8rem}
|
|
845
|
-
`;
|
|
934
|
+
function flow(scene, step, pose, wide) {
|
|
935
|
+
const all = scene.flow ?? [];
|
|
936
|
+
const seen = new Map;
|
|
937
|
+
for (const one of all) {
|
|
938
|
+
seen.set(one, (seen.get(one) ?? 0) + 1);
|
|
939
|
+
}
|
|
940
|
+
const columns = all.reduce((sum, one) => sum + EpisodeAss.columns(one), 0);
|
|
941
|
+
const row = wide && all.length <= 4 ? (140 - all.length * 8.6) / (columns * 0.5 + all.length) : Infinity;
|
|
942
|
+
const size = Math.max(3, Math.min(all.length <= 4 ? wide ? 6.4 : 5.2 : all.length <= 8 ? wide ? 5.2 : 4.4 : wide ? 4.4 : 3.6, row));
|
|
943
|
+
const nodes = all.slice(0, step).map((one, i) => '<span class="step">' + (i ? '<i class="arrow">→</i>' : "") + '<span class="node' + ((seen.get(one) ?? 0) > 1 ? " hub" : "") + (i === step - 1 && step < all.length ? " now" : "") + '">' + html(one) + "</span></span>").join("");
|
|
944
|
+
const done = step >= all.length;
|
|
945
|
+
const note = scene.note && done ? `<div class="bubble">${html(scene.note)}</div>` : "";
|
|
946
|
+
const dinoPose = done ? { arms: "up", eyes: "happy" } : pose ? { arms: "out", eyes: "n" } : { arms: "down", eyes: "d" };
|
|
947
|
+
return '<div class="chart">' + (scene.title ? `<h1>${html(scene.title)}</h1>` : "") + '<div class="chain" style="font-size:' + size.toFixed(2) + 'rem">' + nodes + "</div>" + note + '</div><div class="side"><div class="host' + (pose ? " up" : "") + '">' + dino(wide ? 30 : 22, dinoPose) + '<div class="shadow"></div></div></div>';
|
|
948
|
+
}
|
|
846
949
|
})(EpisodeStage ||= {});
|
|
847
950
|
|
|
848
951
|
// web-src/render.ts
|
|
849
952
|
var EpisodeRender;
|
|
850
953
|
((EpisodeRender) => {
|
|
851
954
|
const GAP = 0.6;
|
|
955
|
+
const LOUDNESS = "loudnorm=I=-16:TP=-1.5:LRA=11";
|
|
852
956
|
const RATE = 185;
|
|
853
957
|
const BACKGROUND = "0x16171c";
|
|
854
958
|
EpisodeRender.VOICE = "zh-CN-XiaoxiaoNeural";
|
|
@@ -856,7 +960,7 @@ var EpisodeRender;
|
|
|
856
960
|
async function run(file, options) {
|
|
857
961
|
const episode = JSON.parse(await readFile2(file, "utf8"));
|
|
858
962
|
if (!episode?.title || !Array.isArray(episode.scenes) || !episode.scenes.length) {
|
|
859
|
-
throw new Error("An episode is { title, scenes: [{ say, code?, title?, sub?, points? }] }.");
|
|
963
|
+
throw new Error("An episode is { title, scenes: [{ say, code?, phone?, title?, sub?, points?, flow? }] }.");
|
|
860
964
|
}
|
|
861
965
|
await mkdir(options.out, { recursive: true });
|
|
862
966
|
return options.post ? post(episode, options) : video(episode, options);
|
|
@@ -923,7 +1027,26 @@ var EpisodeRender;
|
|
|
923
1027
|
await writeFile3(list, parts.map((one) => `file '${one.replace(/'/g, "'\\''")}'`).join(`
|
|
924
1028
|
`));
|
|
925
1029
|
const voice = join3(options.out, "voice.m4a");
|
|
926
|
-
await exec("ffmpeg", [
|
|
1030
|
+
await exec("ffmpeg", [
|
|
1031
|
+
"-y",
|
|
1032
|
+
"-loglevel",
|
|
1033
|
+
"error",
|
|
1034
|
+
"-f",
|
|
1035
|
+
"concat",
|
|
1036
|
+
"-safe",
|
|
1037
|
+
"0",
|
|
1038
|
+
"-i",
|
|
1039
|
+
list,
|
|
1040
|
+
"-af",
|
|
1041
|
+
LOUDNESS,
|
|
1042
|
+
"-ar",
|
|
1043
|
+
"48000",
|
|
1044
|
+
"-c:a",
|
|
1045
|
+
"aac",
|
|
1046
|
+
"-b:a",
|
|
1047
|
+
"192k",
|
|
1048
|
+
voice
|
|
1049
|
+
]);
|
|
927
1050
|
await writeFile3(join3(options.out, "captions.srt"), srt(timed));
|
|
928
1051
|
const made = [voice, join3(options.out, "captions.srt")];
|
|
929
1052
|
if (chrome) {
|
|
@@ -953,7 +1076,7 @@ var EpisodeRender;
|
|
|
953
1076
|
"-preset",
|
|
954
1077
|
"medium",
|
|
955
1078
|
"-crf",
|
|
956
|
-
"
|
|
1079
|
+
"18",
|
|
957
1080
|
"-pix_fmt",
|
|
958
1081
|
"yuv420p",
|
|
959
1082
|
"-c:a",
|
|
@@ -1001,19 +1124,31 @@ var EpisodeRender;
|
|
|
1001
1124
|
const timeline = EpisodeStage.timeline(timed, opening);
|
|
1002
1125
|
const drawn = new Map;
|
|
1003
1126
|
const picture = async (shot) => {
|
|
1004
|
-
const
|
|
1005
|
-
let file = drawn.get(
|
|
1127
|
+
const page = EpisodeStage.frame(episode, shot, aspect);
|
|
1128
|
+
let file = drawn.get(page);
|
|
1006
1129
|
if (!file) {
|
|
1007
|
-
file = join3(work, `${name}-${
|
|
1008
|
-
await browser.shoot(
|
|
1009
|
-
drawn.set(
|
|
1130
|
+
file = join3(work, `${name}-${drawn.size}.png`);
|
|
1131
|
+
await browser.shoot(page, file);
|
|
1132
|
+
drawn.set(page, file);
|
|
1010
1133
|
}
|
|
1011
1134
|
return file;
|
|
1012
1135
|
};
|
|
1013
|
-
const
|
|
1136
|
+
const held = [];
|
|
1137
|
+
let at = 0;
|
|
1014
1138
|
for (const one of timeline) {
|
|
1015
|
-
|
|
1139
|
+
const file = await picture(one.shot);
|
|
1140
|
+
const last = held[held.length - 1];
|
|
1141
|
+
if (last?.file === file) {
|
|
1142
|
+
last.to = at + one.seconds;
|
|
1143
|
+
} else {
|
|
1144
|
+
held.push({ file, from: at, to: at + one.seconds });
|
|
1145
|
+
}
|
|
1146
|
+
at += one.seconds;
|
|
1016
1147
|
}
|
|
1148
|
+
const list = held.flatMap((one) => [
|
|
1149
|
+
`file '${one.file.replace(/'/g, "'\\''")}'`,
|
|
1150
|
+
`duration ${(Math.round(one.to * 1000) - Math.round(one.from * 1000)) / 1000}`
|
|
1151
|
+
]);
|
|
1017
1152
|
list.push(list[list.length - 2]);
|
|
1018
1153
|
const listFile = join3(work, `${name}.txt`);
|
|
1019
1154
|
await writeFile3(listFile, list.join(`
|
|
@@ -1042,7 +1177,7 @@ var EpisodeRender;
|
|
|
1042
1177
|
"-preset",
|
|
1043
1178
|
"medium",
|
|
1044
1179
|
"-crf",
|
|
1045
|
-
"
|
|
1180
|
+
"18",
|
|
1046
1181
|
"-c:a",
|
|
1047
1182
|
"copy",
|
|
1048
1183
|
"-movflags",
|