-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
265 lines (239 loc) · 10.3 KB
/
Copy pathindex.html
File metadata and controls
265 lines (239 loc) · 10.3 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>scroll-timeline-builder — visual builder for CSS scroll-driven animations</title>
<meta name="description" content="A zero-dependency visual builder for CSS scroll-driven animations: configure scroll() and view() timelines, ranges and keyframes, preview them live, and copy production-ready CSS.">
<link rel="stylesheet" href="styles/app.css">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><text y='13' font-size='13'>📜</text></svg>">
</head>
<body>
<a class="skip-link" href="#controls">Skip to controls</a>
<header class="app-header">
<div class="app-header__title">
<h1>scroll-timeline-builder</h1>
<p class="tagline">Build a CSS scroll-driven animation, watch it run, copy the CSS.</p>
</div>
<div class="app-header__actions">
<label class="field field--inline">
<span>Preset</span>
<select id="preset-select">
<option value="">Custom…</option>
</select>
</label>
<button type="button" id="copy-link" class="btn">Copy share link</button>
<button type="button" id="reset" class="btn btn--quiet">Reset</button>
</div>
</header>
<div id="support-banner" class="banner" role="status" hidden></div>
<main class="layout">
<!-- ------------------------------------------------------------------ -->
<!-- Controls -->
<!-- ------------------------------------------------------------------ -->
<form id="controls" class="panel panel--controls" aria-label="Animation settings">
<fieldset class="group">
<legend>Timeline</legend>
<div class="radio-row" role="radiogroup" aria-label="Timeline mode">
<label class="radio"><input type="radio" name="mode" value="scroll"> <span>scroll()</span></label>
<label class="radio"><input type="radio" name="mode" value="view"> <span>view()</span></label>
<label class="radio"><input type="radio" name="mode" value="named"> <span>Named</span></label>
</div>
<p class="hint" id="mode-hint"></p>
<div data-show="named" class="stack">
<label class="field">
<span>Timeline kind</span>
<select id="named-kind">
<option value="scroll">scroll-timeline-name</option>
<option value="view">view-timeline-name</option>
</select>
</label>
<label class="field">
<span>Timeline name</span>
<input type="text" id="timeline-name" spellcheck="false" autocomplete="off">
</label>
<label class="check">
<input type="checkbox" id="use-timeline-scope">
<span>Share via <code>timeline-scope</code> on an ancestor</span>
</label>
</div>
<div data-show="scroller" class="stack">
<label class="field">
<span>Scroller</span>
<select id="scroller">
<option value="nearest">nearest</option>
<option value="root">root</option>
<option value="self">self</option>
</select>
</label>
</div>
<label class="field">
<span>Axis</span>
<select id="axis">
<option value="block">block</option>
<option value="inline">inline</option>
<option value="x">x</option>
<option value="y">y</option>
</select>
</label>
<div data-show="view" class="stack">
<div class="field-row">
<label class="field">
<span>Inset start</span>
<input type="text" id="inset-start" spellcheck="false" autocomplete="off" placeholder="0">
</label>
<label class="field">
<span>Inset end</span>
<input type="text" id="inset-end" spellcheck="false" autocomplete="off" placeholder="0">
</label>
</div>
<p class="hint">Shrinks the scrollport the subject is measured against. Accepts px or %.</p>
</div>
</fieldset>
<fieldset class="group">
<legend>Animation range</legend>
<div data-show="view" class="stack">
<div class="field-row">
<label class="field">
<span>Start range</span>
<select id="range-start-name"></select>
</label>
<label class="field">
<span>Start offset (%)</span>
<input type="number" id="range-start-offset" step="1" min="-100" max="200">
</label>
</div>
<div class="field-row">
<label class="field">
<span>End range</span>
<select id="range-end-name"></select>
</label>
<label class="field">
<span>End offset (%)</span>
<input type="number" id="range-end-offset" step="1" min="-100" max="200">
</label>
</div>
</div>
<div data-show="scroll-range" class="stack">
<div class="field-row">
<label class="field">
<span>Range start</span>
<input type="text" id="range-scroll-start" spellcheck="false" autocomplete="off" placeholder="normal">
</label>
<label class="field">
<span>Range end</span>
<input type="text" id="range-scroll-end" spellcheck="false" autocomplete="off" placeholder="normal">
</label>
</div>
<p class="hint">Scroll timelines take <code>normal</code>, a length (<code>200px</code>) or a percentage.</p>
</div>
</fieldset>
<fieldset class="group">
<legend>Easing</legend>
<label class="field">
<span>Function</span>
<select id="easing-type">
<option value="linear">linear</option>
<option value="ease">ease</option>
<option value="ease-in">ease-in</option>
<option value="ease-out">ease-out</option>
<option value="ease-in-out">ease-in-out</option>
<option value="steps">steps()</option>
<option value="cubic-bezier">cubic-bezier()</option>
</select>
</label>
<div data-show="steps" class="field-row">
<label class="field">
<span>Steps</span>
<input type="number" id="easing-steps" min="1" max="60" step="1">
</label>
<label class="field">
<span>Position</span>
<select id="easing-step-position">
<option value="jump-start">jump-start</option>
<option value="jump-end">jump-end</option>
<option value="jump-none">jump-none</option>
<option value="jump-both">jump-both</option>
</select>
</label>
</div>
<div data-show="bezier" class="field-row field-row--4">
<label class="field"><span>x1</span><input type="number" id="bezier-0" step="0.01" min="0" max="1"></label>
<label class="field"><span>y1</span><input type="number" id="bezier-1" step="0.01"></label>
<label class="field"><span>x2</span><input type="number" id="bezier-2" step="0.01" min="0" max="1"></label>
<label class="field"><span>y2</span><input type="number" id="bezier-3" step="0.01"></label>
</div>
</fieldset>
<fieldset class="group">
<legend>Keyframes</legend>
<div id="keyframe-list" class="keyframes"></div>
<button type="button" id="add-stop" class="btn btn--wide">+ Add keyframe stop</button>
</fieldset>
<fieldset class="group">
<legend>Output naming</legend>
<div class="field-row">
<label class="field">
<span>@keyframes name</span>
<input type="text" id="animation-name" spellcheck="false" autocomplete="off">
</label>
<label class="field">
<span>Subject class</span>
<input type="text" id="subject-class" spellcheck="false" autocomplete="off">
</label>
</div>
</fieldset>
</form>
<!-- ------------------------------------------------------------------ -->
<!-- Preview + output -->
<!-- ------------------------------------------------------------------ -->
<div class="panel panel--preview">
<div class="panel__head">
<h2>Preview</h2>
<label class="field field--inline">
<span>Layout</span>
<select id="layout">
<option value="card">Single card</option>
<option value="cards">Row of cards</option>
<option value="hero">Full-bleed hero</option>
<option value="progress">Progress bar</option>
</select>
</label>
</div>
<div id="preview-stage" class="preview-stage"></div>
<div class="scrub">
<label class="field field--inline scrub__control">
<span>Scrub</span>
<input type="range" id="scrub" min="0" max="100" step="0.5" value="0"
aria-describedby="scrub-hint">
</label>
<output id="scrub-value" for="scrub">0%</output>
<button type="button" id="scrub-release" class="btn btn--quiet">Back to scrolling</button>
</div>
<p class="hint" id="scrub-hint">
Drag to drive progress by hand. Scrubbing uses the Web Animations API, so it works even
where scroll-driven animations are unsupported.
</p>
<div class="panel__head panel__head--code">
<h2>Generated code</h2>
<div class="tabs" role="tablist" aria-label="Generated code format">
<button type="button" class="tab" role="tab" id="tab-css" aria-controls="code-css" aria-selected="true">CSS</button>
<button type="button" class="tab" role="tab" id="tab-html" aria-controls="code-html" aria-selected="false">HTML</button>
</div>
<button type="button" id="copy-code" class="btn">Copy CSS</button>
</div>
<pre id="code-css" class="code" role="tabpanel" aria-labelledby="tab-css" tabindex="0"></pre>
<pre id="code-html" class="code" role="tabpanel" aria-labelledby="tab-html" tabindex="0" hidden></pre>
</div>
</main>
<footer class="app-footer">
<p>
Open source, zero dependencies.
Background reading:
<a href="https://www.css-scroll-driven.com/core-animation-fundamentals-browser-mechanics/understanding-the-css-scroll-timeline-api/">
understanding the CSS scroll-timeline API</a>.
</p>
</footer>
<div id="toast" class="toast" role="status" aria-live="polite"></div>
<script type="module" src="src/main.js"></script>
</body>
</html>