Pabloler21 Claude Fable 5 commited on
Commit
9b82354
Β·
1 Parent(s): 915fdd8

feat: screamer flicker + gothic Fear & Hunger framing

Browse files

Verified against the running app via headless screenshots.

Flashes:
- the capture flash now hard-cuts through ALL four faces (terror/almost/end/
base) in a ~0.55s steps() flicker β€” too fast to read, the portrait seems to
convulse through what it could become
- the full-screen echo is now a real screamer: face stabs the whole screen for
a few frames at 0.5 opacity, gone in ~0.5s

Gothic framing (medieval, F&H):
- the child sits behind a pointed lancet arch (cathedral window): the scene is
SVG-masked to the arch, a stone frame with bronze keystone + base blocks
traces it
- reusable --goth-frame border-image (double stone line, thickened corner
brackets, bone studs) applied to the treasure reliquary, the visitor bubble
and the send rune
- treasure restructured: frame on the panel, fade mask moved to an inner
scroller so the mask no longer eats the border-image
- bone/bronze palette for visibility against the void

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files changed (5) hide show
  1. .gitignore +1 -0
  2. render.py +17 -8
  3. styles.css +126 -52
  4. tests/test_render.py +4 -4
  5. tools/visual_check.py +20 -0
.gitignore CHANGED
@@ -225,3 +225,4 @@ assets/*.png
225
 
226
  # Visual check harness output
227
  tools/_visual/
 
 
225
 
226
  # Visual check harness output
227
  tools/_visual/
228
+ tools/_visual/
render.py CHANGED
@@ -92,15 +92,16 @@ def render_entity(affinity: int, mode: str = "idle", seq: int = 0) -> str:
92
  flash = ""
93
  if mode in ("flash", "flash_strong"):
94
  strong = " entity-flash-strong" if mode == "flash_strong" else ""
95
- # the terror cuts through the fog: much sharper than the portrait
96
- flash_look = (
97
- f"filter:blur({round(blur * 0.35, 1)}px);"
98
- f"opacity:{max(opacity, 0.85)};transform:scale({scale});"
 
 
99
  )
100
  flash = (
101
- f'<div class="entity-flash-wrap" style="{flash_look}">'
102
- f'<img class="entity-flash {flash_key}{strong}" src="{_src("terror")}">'
103
- "</div>"
104
  )
105
  if mode == "flash_strong":
106
  ghost = (
@@ -109,12 +110,15 @@ def render_entity(affinity: int, mode: str = "idle", seq: int = 0) -> str:
109
  )
110
 
111
  return (
 
112
  '<div class="entity-stage">'
113
  f"{figure}{flash}"
114
  f'<div class="entity-fog" style="opacity:{fog_op}"></div>'
115
  f'<div class="entity-grain" style="opacity:{grain_op}"></div>'
116
  f'<div class="entity-vig" style="opacity:{vig_op}"></div>'
117
  "</div>"
 
 
118
  f"{ghost}"
119
  )
120
 
@@ -143,4 +147,9 @@ def render_treasure(treasure: list[str], struck: set[str] | None = None,
143
  f'<div style="{style}">{html.escape(m, quote=True)}</div>'
144
  )
145
  body = "".join(parts)
146
- return f'<div class="treasure-panel" style="{_PANEL}">{header}{body}</div>'
 
 
 
 
 
 
92
  flash = ""
93
  if mode in ("flash", "flash_strong"):
94
  strong = " entity-flash-strong" if mode == "flash_strong" else ""
95
+ # a fast subliminal flicker through every face β€” too quick to read,
96
+ # the portrait seems to convulse through what it could become
97
+ flash_look = f"transform:scale({scale});"
98
+ layers = "".join(
99
+ f'<img class="entity-flick flick-{i}" src="{_src(n)}">'
100
+ for i, n in enumerate(("terror", "almost", "end", "base"))
101
  )
102
  flash = (
103
+ f'<div class="entity-flash-wrap {flash_key}{strong}" style="{flash_look}">'
104
+ f"{layers}</div>"
 
105
  )
106
  if mode == "flash_strong":
107
  ghost = (
 
110
  )
111
 
112
  return (
113
+ '<div class="entity-portal">'
114
  '<div class="entity-stage">'
115
  f"{figure}{flash}"
116
  f'<div class="entity-fog" style="opacity:{fog_op}"></div>'
117
  f'<div class="entity-grain" style="opacity:{grain_op}"></div>'
118
  f'<div class="entity-vig" style="opacity:{vig_op}"></div>'
119
  "</div>"
120
+ '<div class="entity-frame"></div>'
121
+ "</div>"
122
  f"{ghost}"
123
  )
124
 
 
147
  f'<div style="{style}">{html.escape(m, quote=True)}</div>'
148
  )
149
  body = "".join(parts)
150
+ return (
151
+ f'<div class="treasure-panel" style="{_PANEL}">'
152
+ f"{header}"
153
+ f'<div class="treasure-scroll">{body}</div>'
154
+ "</div>"
155
+ )
styles.css CHANGED
@@ -381,14 +381,28 @@ footer { display: none !important; }
381
  }
382
  }
383
 
384
- /* ── 15. Entity panel β€” the child in the fog ──── */
385
- .entity-stage {
386
  position: relative;
387
  aspect-ratio: 5 / 6;
 
 
 
 
 
 
388
  overflow: hidden;
389
- border-radius: 6px;
390
  background: #0b0a10;
391
- border: 1px solid #1c1528;
 
 
 
 
 
 
 
 
 
392
  }
393
 
394
  .entity-figure {
@@ -414,60 +428,53 @@ footer { display: none !important; }
414
  object-fit: cover;
415
  }
416
 
417
- /* terror flash: one-shot; animation-name alternates per turn (flash-0/flash-1)
418
- so the animation restarts even when Gradio morphs the DOM in place */
 
419
  .entity-flash-wrap {
420
  position: absolute;
421
  inset: 0;
422
  }
423
 
424
- .entity-flash {
425
  position: absolute;
426
  inset: 0;
427
  width: 100%;
428
  height: 100%;
429
  object-fit: cover;
430
  opacity: 0;
431
- animation-duration: 2.5s;
432
- animation-timing-function: ease-out;
433
  animation-fill-mode: forwards;
434
  }
435
 
436
- .entity-flash.flash-0 { animation-name: entity-flash-a; }
437
- .entity-flash.flash-1 { animation-name: entity-flash-b; }
438
 
439
- .entity-flash.entity-flash-strong { animation-duration: 3s; }
440
- .entity-flash.entity-flash-strong.flash-0 { animation-name: entity-flash-a, entity-glitch-a; }
441
- .entity-flash.entity-flash-strong.flash-1 { animation-name: entity-flash-b, entity-glitch-b; }
 
 
442
 
443
- @keyframes entity-flash-a {
444
- 0% { opacity: 0; }
445
- 10% { opacity: 1; }
446
- 80% { opacity: 1; }
447
- 100% { opacity: 0; }
448
  }
449
-
450
- @keyframes entity-flash-b {
451
- 0% { opacity: 0; }
452
- 10% { opacity: 1; }
453
- 80% { opacity: 1; }
454
- 100% { opacity: 0; }
455
  }
456
-
457
- @keyframes entity-glitch-a {
458
- 0%, 100% { transform: translate(0, 0); }
459
- 20% { transform: translate(-3px, 1px); }
460
- 40% { transform: translate(2px, -2px); }
461
- 60% { transform: translate(-2px, 2px); }
462
- 80% { transform: translate(3px, -1px); }
463
  }
464
-
465
- @keyframes entity-glitch-b {
466
- 0%, 100% { transform: translate(0, 0); }
467
- 20% { transform: translate(-3px, 1px); }
468
- 40% { transform: translate(2px, -2px); }
469
- 60% { transform: translate(-2px, 2px); }
470
- 80% { transform: translate(3px, -1px); }
471
  }
472
 
473
  /* subliminal full-screen echo β€” recall turns and the finale only */
@@ -479,26 +486,31 @@ footer { display: none !important; }
479
  background-size: cover;
480
  background-position: center 25%;
481
  opacity: 0;
482
- filter: grayscale(1) blur(2px);
483
- animation-duration: 2.4s;
484
- animation-timing-function: ease-out;
485
  animation-fill-mode: forwards;
486
  }
487
 
 
488
  .entity-ghost.flash-0 { animation-name: entity-ghost-a; }
489
  .entity-ghost.flash-1 { animation-name: entity-ghost-b; }
490
 
491
  @keyframes entity-ghost-a {
492
  0% { opacity: 0; }
493
- 15% { opacity: 0.18; }
494
- 60% { opacity: 0.12; }
 
 
495
  100% { opacity: 0; }
496
  }
497
 
498
  @keyframes entity-ghost-b {
499
  0% { opacity: 0; }
500
- 15% { opacity: 0.18; }
501
- 60% { opacity: 0.12; }
 
 
502
  100% { opacity: 0; }
503
  }
504
 
@@ -534,22 +546,84 @@ footer { display: none !important; }
534
  background: radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(5,4,9,0.82) 100%);
535
  }
536
 
537
- /* ── 16. Treasure β€” fixed-height case with inner scroll ── */
538
- /* items sink into the dark at both edges instead of clipping */
 
539
  .treasure-panel {
540
  height: 500px;
 
 
 
 
 
 
541
  overflow-y: auto;
 
 
542
  -webkit-mask-image: linear-gradient(
543
- to bottom, transparent 0, #000 16px, #000 calc(100% - 22px), transparent 100%);
544
  mask-image: linear-gradient(
545
- to bottom, transparent 0, #000 16px, #000 calc(100% - 22px), transparent 100%);
546
  }
547
 
548
  /* reduced motion: kill real MOTION (drift, sway, glitch translate) but keep
549
  the terror flash and echo β€” they are opacity fades, not movement, and they
550
  are the core horror beat. Strip only the glitch from the strong variant. */
551
  @media (prefers-reduced-motion: reduce) {
 
 
552
  .entity-sway, .entity-fog { animation: none !important; }
553
- .entity-flash.entity-flash-strong.flash-0 { animation-name: entity-flash-a !important; }
554
- .entity-flash.entity-flash-strong.flash-1 { animation-name: entity-flash-b !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  }
 
381
  }
382
  }
383
 
384
+ /* ── 15. Entity panel β€” the child behind a gothic arch ── */
385
+ .entity-portal {
386
  position: relative;
387
  aspect-ratio: 5 / 6;
388
+ }
389
+
390
+ /* the scene is masked to a pointed (lancet) arch β€” a cathedral window */
391
+ .entity-stage {
392
+ position: absolute;
393
+ inset: 0;
394
  overflow: hidden;
 
395
  background: #0b0a10;
396
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120' preserveAspectRatio='none'%3E%3Cpath d='M0,120 L0,52 A58,58 0 0 1 50,4 A58,58 0 0 1 100,52 L100,120 Z' fill='%23fff'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
397
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120' preserveAspectRatio='none'%3E%3Cpath d='M0,120 L0,52 A58,58 0 0 1 50,4 A58,58 0 0 1 100,52 L100,120 Z' fill='%23fff'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
398
+ }
399
+
400
+ /* stone arch frame: double stroke, keystone at the apex, base blocks */
401
+ .entity-frame {
402
+ position: absolute;
403
+ inset: 0;
404
+ pointer-events: none;
405
+ background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120' preserveAspectRatio='none'%3E%3Cpath d='M2,120 L2,52 A56,56 0 0 1 50,6 A56,56 0 0 1 98,52 L98,120' fill='none' stroke='%23322a44' stroke-width='4.5'/%3E%3Cpath d='M4,120 L4,53 A54,54 0 0 1 50,7 A54,54 0 0 1 96,53 L96,120' fill='none' stroke='%239c8a5e' stroke-width='1.7'/%3E%3Cpath d='M50,0 L59,9 L50,19 L41,9 Z' fill='%233a3120' stroke='%23d2be8a' stroke-width='1'/%3E%3Crect x='0' y='107' width='18' height='13' fill='%23231d14' stroke='%239c8a5e' stroke-width='1'/%3E%3Crect x='82' y='107' width='18' height='13' fill='%23231d14' stroke='%239c8a5e' stroke-width='1'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
406
  }
407
 
408
  .entity-figure {
 
428
  object-fit: cover;
429
  }
430
 
431
+ /* terror flicker: a fast subliminal convulsion through every face. Hard
432
+ steps() cuts, ~0.55s total, too quick to read. The DOM is replaced each
433
+ turn so the one-shot animations always restart. */
434
  .entity-flash-wrap {
435
  position: absolute;
436
  inset: 0;
437
  }
438
 
439
+ .entity-flick {
440
  position: absolute;
441
  inset: 0;
442
  width: 100%;
443
  height: 100%;
444
  object-fit: cover;
445
  opacity: 0;
446
+ animation-duration: 0.55s;
447
+ animation-timing-function: steps(1, end);
448
  animation-fill-mode: forwards;
449
  }
450
 
451
+ .entity-flash-wrap.entity-flash-strong .entity-flick { animation-duration: 0.7s; }
 
452
 
453
+ /* each face blinks in its own scattered windows β€” they overlap into chaos */
454
+ .flick-0 { animation-name: flick-terror; } /* terror β€” appears most */
455
+ .flick-1 { animation-name: flick-almost; }
456
+ .flick-2 { animation-name: flick-end; }
457
+ .flick-3 { animation-name: flick-base; } /* settles back to the portrait */
458
 
459
+ @keyframes flick-terror {
460
+ 0%, 100% { opacity: 0; }
461
+ 4% { opacity: 1; } 11% { opacity: 0; }
462
+ 34% { opacity: 1; } 42% { opacity: 0; }
463
+ 62% { opacity: 1; } 70% { opacity: 0; }
464
  }
465
+ @keyframes flick-almost {
466
+ 0%, 100% { opacity: 0; }
467
+ 14% { opacity: 1; } 22% { opacity: 0; }
468
+ 50% { opacity: 1; } 57% { opacity: 0; }
 
 
469
  }
470
+ @keyframes flick-end {
471
+ 0%, 100% { opacity: 0; }
472
+ 24% { opacity: 1; } 31% { opacity: 0; }
473
+ 76% { opacity: 1; } 82% { opacity: 0; }
 
 
 
474
  }
475
+ @keyframes flick-base {
476
+ 0%, 86% { opacity: 0; }
477
+ 90%, 100% { opacity: 1; }
 
 
 
 
478
  }
479
 
480
  /* subliminal full-screen echo β€” recall turns and the finale only */
 
486
  background-size: cover;
487
  background-position: center 25%;
488
  opacity: 0;
489
+ filter: grayscale(1) blur(1px);
490
+ animation-duration: 0.5s;
491
+ animation-timing-function: steps(1, end);
492
  animation-fill-mode: forwards;
493
  }
494
 
495
+ /* a real screamer: the face stabs the whole screen for a few frames, gone */
496
  .entity-ghost.flash-0 { animation-name: entity-ghost-a; }
497
  .entity-ghost.flash-1 { animation-name: entity-ghost-b; }
498
 
499
  @keyframes entity-ghost-a {
500
  0% { opacity: 0; }
501
+ 8% { opacity: 0.55; }
502
+ 18% { opacity: 0; }
503
+ 26% { opacity: 0.4; }
504
+ 34% { opacity: 0; }
505
  100% { opacity: 0; }
506
  }
507
 
508
  @keyframes entity-ghost-b {
509
  0% { opacity: 0; }
510
+ 8% { opacity: 0.55; }
511
+ 18% { opacity: 0; }
512
+ 26% { opacity: 0.4; }
513
+ 34% { opacity: 0; }
514
  100% { opacity: 0; }
515
  }
516
 
 
546
  background: radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(5,4,9,0.82) 100%);
547
  }
548
 
549
+ /* ── 16. Treasure β€” stone reliquary with inner scroll ── */
550
+ /* the frame lives on the panel; the fade mask lives on the inner scroller,
551
+ so the mask can't eat the border-image */
552
  .treasure-panel {
553
  height: 500px;
554
+ display: flex;
555
+ flex-direction: column;
556
+ }
557
+
558
+ .treasure-scroll {
559
+ flex: 1;
560
  overflow-y: auto;
561
+ min-height: 0;
562
+ margin-top: 6px;
563
  -webkit-mask-image: linear-gradient(
564
+ to bottom, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
565
  mask-image: linear-gradient(
566
+ to bottom, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
567
  }
568
 
569
  /* reduced motion: kill real MOTION (drift, sway, glitch translate) but keep
570
  the terror flash and echo β€” they are opacity fades, not movement, and they
571
  are the core horror beat. Strip only the glitch from the strong variant. */
572
  @media (prefers-reduced-motion: reduce) {
573
+ /* kill ambient drift only β€” the flicker and screamer are opacity, the core
574
+ horror beat, and must always play */
575
  .entity-sway, .entity-fog { animation: none !important; }
576
+ }
577
+
578
+ /* ── 17. Gothic stone frames β€” Fear & Hunger panels ── */
579
+ /* a reusable 9-slice border: double stone line, thickened corner brackets,
580
+ small studs. Applied to every box so the whole UI reads medieval. */
581
+ :root {
582
+ --goth-frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect x='3' y='3' width='94' height='94' fill='none' stroke='%23322a44' stroke-width='3'/%3E%3Crect x='6.5' y='6.5' width='87' height='87' fill='none' stroke='%239c8a5e' stroke-width='1.8'/%3E%3Cg fill='%23534526'%3E%3Cpath d='M1,1 h24 v4.5 h-19.5 v19.5 h-4.5 Z'/%3E%3Cpath d='M99,1 h-24 v4.5 h19.5 v19.5 h4.5 Z'/%3E%3Cpath d='M1,99 h24 v-4.5 h-19.5 v-19.5 h-4.5 Z'/%3E%3Cpath d='M99,99 h-24 v-4.5 h19.5 v-19.5 h4.5 Z'/%3E%3C/g%3E%3Cg fill='%23d2be8a'%3E%3Ccircle cx='9' cy='9' r='3.2'/%3E%3Ccircle cx='91' cy='9' r='3.2'/%3E%3Ccircle cx='9' cy='91' r='3.2'/%3E%3Ccircle cx='91' cy='91' r='3.2'/%3E%3C/g%3E%3C/svg%3E");
583
+ }
584
+
585
+ .goth-frame {
586
+ border: 11px solid transparent !important;
587
+ border-image-source: var(--goth-frame) !important;
588
+ border-image-slice: 30 !important;
589
+ border-image-width: 11px !important;
590
+ border-image-repeat: stretch !important;
591
+ border-radius: 0 !important;
592
+ }
593
+
594
+ /* Treasure: stone reliquary. Keep the inner scroll + edge fade. */
595
+ .treasure-panel {
596
+ border: 11px solid transparent !important;
597
+ border-image-source: var(--goth-frame) !important;
598
+ border-image-slice: 30 !important;
599
+ border-image-width: 11px !important;
600
+ border-image-repeat: stretch !important;
601
+ border-radius: 0 !important;
602
+ background: #0b0912 !important;
603
+ }
604
+
605
+ /* Visitor's words: a carved confession box */
606
+ .user {
607
+ border: 10px solid transparent !important;
608
+ border-image-source: var(--goth-frame) !important;
609
+ border-image-slice: 30 !important;
610
+ border-image-width: 10px !important;
611
+ border-image-repeat: stretch !important;
612
+ border-radius: 0 !important;
613
+ background: #110c1a !important;
614
+ }
615
+
616
+ /* Send rune: an iron stud */
617
+ .gradio-container button {
618
+ border: 10px solid transparent !important;
619
+ border-image-source: var(--goth-frame) !important;
620
+ border-image-slice: 30 !important;
621
+ border-image-width: 10px !important;
622
+ border-image-repeat: stretch !important;
623
+ border-radius: 0 !important;
624
+ }
625
+
626
+ /* Title as carved stone */
627
+ .gradio-container h2 {
628
+ border-bottom: none !important;
629
  }
tests/test_render.py CHANGED
@@ -72,11 +72,11 @@ class TestRenderEntity:
72
  assert "entity-flash-strong" in render_entity(40, "flash_strong")
73
  assert "entity-flash-strong" not in render_entity(40, "flash")
74
 
75
- def test_flash_overlay_cuts_through_the_fog(self):
76
- # the terror face is much sharper and brighter than the portrait
77
  out = render_entity(0, "flash")
78
- assert "blur(3.5px)" in out # 0.35 * 10 β€” flash wrap
79
- assert "opacity:0.85" in out # floor, even when the figure is faint
80
 
81
  def test_end_mode_shows_end_image_only(self):
82
  out = render_entity(100, "end")
 
72
  assert "entity-flash-strong" in render_entity(40, "flash_strong")
73
  assert "entity-flash-strong" not in render_entity(40, "flash")
74
 
75
+ def test_flash_flickers_through_every_face(self):
76
+ # the flash stacks all four portraits to convulse between them
77
  out = render_entity(0, "flash")
78
+ assert "flick-0" in out and "flick-3" in out
79
+ assert out.count("entity-flick") == 4
80
 
81
  def test_end_mode_shows_end_image_only(self):
82
  out = render_entity(100, "end")
tools/visual_check.py CHANGED
@@ -55,4 +55,24 @@ page("flash_reduced_motion",
55
  "<p class='subtitle'>prefers-reduced-motion forced β€” flash must still be visible</p>"
56
  + _FORCE_RM + render_entity(40, "flash", seq=1))
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  print(f"pages written to {OUT}")
 
55
  "<p class='subtitle'>prefers-reduced-motion forced β€” flash must still be visible</p>"
56
  + _FORCE_RM + render_entity(40, "flash", seq=1))
57
 
58
+ # gothic frames: portrait arch + treasure + mock bubble/button
59
+ _goth = (
60
+ "<div style='display:flex;gap:30px;align-items:flex-start'>"
61
+ "<div style='width:240px'>" + render_entity(60) + "</div>"
62
+ "<div style='width:280px'>"
63
+ + render_treasure(["had a grandmother who kept bees",
64
+ "grew up where the yard smelled like honey",
65
+ "never learned the words", "had a red bicycle"],
66
+ claimed={"never learned the words"})
67
+ + "</div>"
68
+ "<div style='display:flex;flex-direction:column;gap:20px;width:320px'>"
69
+ "<div class='user' style='padding:14px;color:#cec6dc'>"
70
+ "I still talk to people who are gone.</div>"
71
+ "<button class='gr-button' style='padding:12px 20px;color:#9a7caa;"
72
+ "background:rgba(30,20,46,0.45)'>&rarr;</button>"
73
+ "<div class='goth-frame' style='padding:16px;color:#9a8d6a'>goth-frame sample</div>"
74
+ "</div></div>"
75
+ )
76
+ page("goth", _goth, width=1000)
77
+
78
  print(f"pages written to {OUT}")