Repository navigation
Expand file tree
/
Copy pathdeck-cinema.css
More file actions
153 lines (135 loc) · 6.95 KB
/
Copy pathdeck-cinema.css
File metadata and controls
153 lines (135 loc) · 6.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/* ═══ Cinema layer for <deck-stage> decks ═══
*
* Turns the stage's hard cut into a cover-dissolve and gives each slide an
* entrance choreography, without touching deck-stage.js (which is a copied
* starter component — re-running copy_starter_component overwrites it).
*
* How it can override the engine at all: the shadow stylesheet marks the
* layout properties on ::slotted(*) !important (position/inset/width/height/
* box-sizing) but leaves opacity, visibility, z-index and transition plain.
* For normal declarations the outer tree wins over the inner tree, so the
* rules below take those four; the engine keeps the geometry.
*
* Everything is inside prefers-reduced-motion: no-preference — a
* reduced-motion viewer gets the engine's original instant cut, untouched.
* Every animation resolves to the authored end state, so print (which the
* engine forces to animation end + transition-duration:0) is unaffected.
*
* Per-deck tuning: override the custom properties on the deck-stage element.
* --cin-canvas must match the deck's dominant slide background.
*/
deck-stage {
/* Stage chrome — consumed by deck-cinema.js inside the shadow root. */
--cin-canvas: #f3f2f2;
--cin-stage: radial-gradient(ellipse 90% 70% at 50% 42%, #211d18 0%, #0a0908 72%);
/* Timing. */
--cin-dissolve: 700ms;
--cin-ease: cubic-bezier(.2, .8, .2, 1);
/* Travel distances. */
--cin-rise: 22px;
--cin-rise-head: 30px;
--cin-rise-row: 11px;
/* Ken Burns: images start slightly enlarged and settle to 1 over the dwell.
* Settling *to* the natural size (rather than pushing away from it) keeps
* the end state identical to the authored one, so print and reduced-motion
* both land on an uncropped image. */
--cin-img-from: 1.045;
--cin-img-dur: 22s;
}
@media (prefers-reduced-motion: no-preference) {
/* ── Cover dissolve ──────────────────────────────────────────────────────
* The incoming slide fades in *on top* of the outgoing one, which holds at
* full opacity underneath until the fade completes and then snaps away
* behind it. Cross-fading both at once would composite them against the
* canvas and wash the midpoint out; this way nothing shows through. */
deck-stage > section {
transition: opacity 0s linear var(--cin-dissolve),
visibility 0s linear var(--cin-dissolve);
}
deck-stage > section[data-deck-active] {
z-index: 2;
transition: opacity var(--cin-dissolve) cubic-bezier(.33, 0, .2, 1),
visibility 0s linear 0s;
}
/* ── Entrance choreography ───────────────────────────────────────────────
* Opacity is animated only at the column level; everything nested animates
* transform alone. Two nested opacity fades would multiply and make the
* inner content arrive muddy and late. */
deck-stage > section[data-deck-active] > * {
animation: cin-col 820ms var(--cin-ease) both;
}
deck-stage > section[data-deck-active] > *:nth-child(2) { animation-delay: 90ms; }
deck-stage > section[data-deck-active] > *:nth-child(3) { animation-delay: 165ms; }
deck-stage > section[data-deck-active] h1,
deck-stage > section[data-deck-active] h2 {
animation: cin-head 1s 130ms var(--cin-ease) both;
}
deck-stage > section[data-deck-active] figure {
animation: cin-plate 1.1s 60ms var(--cin-ease) both;
}
deck-stage > section[data-deck-active] p,
deck-stage > section[data-deck-active] figcaption {
animation: cin-row 700ms 300ms var(--cin-ease) both;
}
/* Data ledger fills row by row. */
deck-stage > section[data-deck-active] dl > div {
animation: cin-row 560ms var(--cin-ease) both;
}
deck-stage > section[data-deck-active] dl > div:nth-child(1) { animation-delay: 260ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(2) { animation-delay: 294ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(3) { animation-delay: 328ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(4) { animation-delay: 362ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(5) { animation-delay: 396ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(6) { animation-delay: 430ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(7) { animation-delay: 464ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(8) { animation-delay: 498ms; }
deck-stage > section[data-deck-active] dl > div:nth-child(n+9) { animation-delay: 532ms; }
/* ── Ken Burns ───────────────────────────────────────────────────────────
* The framed plates are overflow:hidden (engine sets it on ::slotted too),
* so the enlarged start state clips to the frame instead of spilling. */
deck-stage > section[data-deck-active] img {
animation: cin-settle var(--cin-img-dur) cubic-bezier(.16, .6, .3, 1) both;
}
@keyframes cin-col {
from { opacity: 0; transform: translate3d(0, var(--cin-rise), 0); }
to { opacity: 1; transform: none; }
}
@keyframes cin-head {
from { transform: translate3d(0, var(--cin-rise-head), 0); }
to { transform: none; }
}
@keyframes cin-row {
from { transform: translate3d(0, var(--cin-rise-row), 0); }
to { transform: none; }
}
@keyframes cin-plate {
from { transform: scale(.985); }
to { transform: none; }
}
@keyframes cin-settle {
from { transform: scale(var(--cin-img-from)); }
to { transform: scale(1); }
}
}
/* ── Far slides are not rendered ─────────────────────────────────────────────
* The engine stacks every slide in the same place and hides the inactive ones
* with visibility and opacity. A hidden slide still has a layout box inside
* the viewport, so a browser fetches its images whether or not they are marked
* lazy: opening a deck used to download every image in it.
*
* Slides more than one step from the active one are therefore taken out of
* rendering altogether. With no layout box their lazy images are not fetched;
* they load when the reader comes within one step. The immediate neighbours
* stay rendered so the next slide's image is already there on arrival and the
* cover dissolve still has its outgoing slide to fade over.
*
* Screen only: print lays every slide out as a page and needs them all.
* A browser without :has() drops this rule and behaves as before.
* !important because most slides set their own display inline (grid, flex),
* which would otherwise win.
* See docs/rfcs/0005-full-bleed-decks.md. */
@media screen {
deck-stage > section:not([data-deck-active]):not([data-deck-active] + section):not(:has(+ section[data-deck-active])) {
display: none !important;
}
}