@duskmoon-dev/css-art 0.1.1 → 0.2.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.
@@ -0,0 +1,315 @@
1
+ @layer css-art {
2
+ @keyframes art-cat-stargazer-blink {
3
+ 0%, 25%, 28%, 100% { height: 0 }
4
+ 26.5% { height: 100% }
5
+ }
6
+
7
+ .art-cat-stargazer {
8
+ --art-cat-stargazer-size: 500px;
9
+
10
+ position: relative;
11
+ font-size: calc(var(--art-cat-stargazer-size) / 90);
12
+ width: var(--art-cat-stargazer-size);
13
+ aspect-ratio: 1;
14
+ overflow: hidden;
15
+ background:
16
+ radial-gradient(circle at 20% 20%, #ffc8 0.20em, #0000 0),
17
+ radial-gradient(circle at 70% 50%, #ffc8 0.25em, #0000 0),
18
+ radial-gradient(circle at 10% 80%, #ffc8 0.20em, #0000 0),
19
+ radial-gradient(circle at 80% 30%, #ffc8 0.30em, #0000 0),
20
+ radial-gradient(circle at 80% 80%, #ffc8 0.23em, #0000 0),
21
+ radial-gradient(circle at 50% 10%, #ff8b 0.3em, #0000 0),
22
+ radial-gradient(circle at 40% 60%, #ffc8 0.20em, #0000 0),
23
+ radial-gradient(circle at 30% 30%, #ffc8 0.20em, #0000 0) 0 0 / 70% 70%,
24
+ radial-gradient(circle at 30% 30%, #ffc8 0.20em, #0000 0) 40% 30% / 50% 70%,
25
+ linear-gradient(#0002, #0000),
26
+ radial-gradient(at 50% 80%, #fcc2, #fff0),
27
+ #023;
28
+
29
+ *, *::before, *::after {
30
+ position: absolute;
31
+ box-sizing: border-box;
32
+ }
33
+
34
+ .moon {
35
+ width: 120%;
36
+ height: 40%;
37
+ left: 50%;
38
+ bottom: 0;
39
+ translate: -50% 60%;
40
+ border-radius: 50% / 100% 100% 0 0;
41
+ box-shadow:
42
+ 0 0 3em #ffc,
43
+ 0 0 9em #ffc8;
44
+ background:
45
+ radial-gradient(at 38% 20%, #0001 2%, #0000 0),
46
+ radial-gradient(13% 8% at 50% 0, #0001 99%, #0000),
47
+ #ffc;
48
+
49
+ &::before {
50
+ content: "";
51
+ width: 18%;
52
+ height: 15%;
53
+ background: #0001;
54
+ border-radius: 50%;
55
+ box-shadow: inset 0 1em #0002;
56
+ rotate: -15deg;
57
+ top: 15%;
58
+ left: 20%;
59
+ scale: 0.8;
60
+ }
61
+
62
+ &::after {
63
+ content: "";
64
+ width: 4%;
65
+ height: 5%;
66
+ background: #0001;
67
+ border-radius: 50%;
68
+ box-shadow: -7em 3em 0 2em #0001;
69
+ rotate: 30deg;
70
+ top: 25%;
71
+ left: 80%;
72
+ scale: 0.8;
73
+ }
74
+ }
75
+
76
+ .cat {
77
+ --fur: #111;
78
+ --fur-dark: #000;
79
+ --skin: pink;
80
+ --suit: #fff;
81
+ --suit-dark: #ddd;
82
+ font-size: 0.4em;
83
+ width: 80em;
84
+ aspect-ratio: 1;
85
+ bottom: 15%;
86
+ left: 50%;
87
+ translate: -50%;
88
+
89
+ .bubble {
90
+ width: 119%;
91
+ height: 103%;
92
+ border-radius: 50%;
93
+ bottom: 25%;
94
+ left: 49%;
95
+ translate: -50%;
96
+ background:
97
+ radial-gradient(circle at 25% 25%, #fff3, #fff0 25%),
98
+ radial-gradient(circle at 15% 45%, #fff1, #fff0 15%),
99
+ radial-gradient(circle at 75% 35%, #fff1, #fff0 50%),
100
+ #fff1;
101
+ box-shadow:
102
+ inset 0 0 1em 1em #acf,
103
+ inset 0 0 5em #fff;
104
+ }
105
+
106
+ .backpack {
107
+ width: 40%;
108
+ left: 50%;
109
+ height: 30%;
110
+ background: #bcd;
111
+ bottom: 0;
112
+ translate: -50%;
113
+ border-radius: 3em;
114
+ }
115
+
116
+ .tail {
117
+ width: 50%;
118
+ height: 50%;
119
+ border-radius: 50%;
120
+ border: 7em solid #0000;
121
+ border-top-color: var(--suit-dark);
122
+ border-left-color: var(--suit-dark);
123
+ clip-path: polygon(100% 0, 100% 100%, 0 30%, 0 0);
124
+ top: 75%;
125
+ left: 52%;
126
+
127
+ &::before {
128
+ content: "";
129
+ width: 7em;
130
+ aspect-ratio: 1;
131
+ background: var(--suit-dark);
132
+ border-radius: 50%;
133
+ left: 81%;
134
+ top: -9%;
135
+ }
136
+ }
137
+
138
+ .body {
139
+ left: 50%;
140
+ translate: -50%;
141
+ bottom: 0;
142
+ width: 35%;
143
+ height: 40%;
144
+ background:
145
+ radial-gradient(circle at 17% 55%, #36c 2em, #0000 0),
146
+ radial-gradient(100% 70% at 50% 0, var(--fur-dark) 50%, #0000 0),
147
+ radial-gradient(150% 70% at 49% 0, var(--fur) 50%, #d99 0 59%, #0000 calc(59% + 1px)),
148
+ var(--suit);
149
+ border-radius: 100% / 200% 200% 20% 20%;
150
+
151
+ .leg {
152
+ width: 165%;
153
+ height: 38%;
154
+ bottom: 0;
155
+ left: 50%;
156
+ translate: -50%;
157
+ border-radius: 8em 8em 100% 100% / 10em 10em 16em 16em;
158
+ scale: 1 -1;
159
+ background:
160
+ radial-gradient(20% 200% at 2% 10%, var(--suit-dark) 20%, #0000 0),
161
+ radial-gradient(20% 200% at 98% 10%, var(--suit-dark) 20%, #0000 0),
162
+ var(--suit);
163
+ }
164
+
165
+ .paw {
166
+ width: 35%;
167
+ height: 49%;
168
+ border: 0.75em solid #777;
169
+ border-top: 0;
170
+ border-radius: 0 0 5em 5em;
171
+ top: 51%;
172
+ rotate: -10deg;
173
+ left: 10%;
174
+ clip-path: polygon(0 20%, 100% 30%, 100% 100%, 0 100%);
175
+
176
+ & + & {
177
+ right: 7%;
178
+ height: 50%;
179
+ left: auto;
180
+ rotate: 13deg;
181
+ scale: -1 1;
182
+ clip-path: polygon(0 25%, 100% 15%, 100% 100%, 0 100%);
183
+ }
184
+ }
185
+ }
186
+
187
+ .ear {
188
+ width: 40%;
189
+ aspect-ratio: 1;
190
+ border: 4em solid var(--fur);
191
+ border-radius: 5% 90% 10% 80%;
192
+ background: var(--skin);
193
+ top: 5%;
194
+ left: 10%;
195
+
196
+ & + & {
197
+ scale: -1 1;
198
+ left: auto;
199
+ right: 10%;
200
+ }
201
+ }
202
+
203
+ .head {
204
+ width: 80%;
205
+ aspect-ratio: 1.1;
206
+ background:
207
+ linear-gradient(#0003, #0000 50%),
208
+ var(--fur);
209
+ left: 50%;
210
+ translate: -50%;
211
+ border-radius: 100% / 125% 125% 80% 75%;
212
+
213
+ .whisker {
214
+ width: 30%;
215
+ height: 30%;
216
+ border-radius: 50%;
217
+ border: 2em solid #0000;
218
+ border-top-color: var(--fur);
219
+ border-left-color: var(--fur);
220
+ clip-path: polygon(100% 0, 100% 100%, 0 30%, 0 0);
221
+
222
+ &:nth-child(1) {
223
+ top: 45%;
224
+ translate: -65%;
225
+ }
226
+ &:nth-child(2) {
227
+ top: 55%;
228
+ translate: -40%;
229
+ rotate: -20deg;
230
+ }
231
+ &:nth-child(3) {
232
+ right: 0%;
233
+ top: 45%;
234
+ translate: 65%;
235
+ rotate: 10deg;
236
+ }
237
+ &:nth-child(4) {
238
+ right: -2%;
239
+ top: 55%;
240
+ translate: 40%;
241
+ rotate: 24deg;
242
+ }
243
+ }
244
+
245
+ .nose {
246
+ width: 10%;
247
+ height: 7%;
248
+ background: var(--skin);
249
+ border-radius: 50%;
250
+ left: 50%;
251
+ translate: -50% -50%;
252
+ top: 55%;
253
+ }
254
+
255
+ .eye {
256
+ --pos: 25%;
257
+ --x1: 50%;
258
+ --x2: 42%;
259
+ width: 35%;
260
+ aspect-ratio: 1;
261
+ border-radius: 50%;
262
+ background:
263
+ radial-gradient(50% 50% at var(--x1) 32%, #fff 25%, #0000 calc(25% + 1px)),
264
+ radial-gradient(50% 50% at var(--x2) 51%, #fff 12%, #0000 calc(12% + 1px)),
265
+ radial-gradient(circle at 60% 40%, #000 35%, #0000 calc(35% + 1px)),
266
+ white;
267
+ left: var(--pos);
268
+ translate: -50% -50%;
269
+ top: 43%;
270
+ overflow: hidden;
271
+
272
+ & + & {
273
+ --x1: 70%;
274
+ --x2: 78%;
275
+ left: calc(100% - var(--pos));
276
+ scale: -1 1;
277
+ }
278
+
279
+ &::before {
280
+ content: "";
281
+ top: -30%;
282
+ left: 50%;
283
+ translate: -50%;
284
+ width: 150%;
285
+ height: 0%;
286
+ background: var(--fur);
287
+ rotate: -10deg;
288
+ animation: art-cat-stargazer-blink 10s linear infinite;
289
+ }
290
+
291
+ &::after {
292
+ content: "";
293
+ bottom: -10%;
294
+ left: 50%;
295
+ translate: -50%;
296
+ width: 150%;
297
+ height: 0%;
298
+ background: var(--fur);
299
+ rotate: -10deg;
300
+ animation: art-cat-stargazer-blink 10s linear infinite;
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ /* Size variants */
308
+ .art-cat-stargazer-sm {
309
+ --art-cat-stargazer-size: 300px;
310
+ }
311
+
312
+ .art-cat-stargazer-lg {
313
+ --art-cat-stargazer-size: 700px;
314
+ }
315
+ }
@@ -0,0 +1,251 @@
1
+ @property --art-circular-gallery-rotation {
2
+ syntax: "<angle>";
3
+ inherits: true;
4
+ initial-value: 0deg;
5
+ }
6
+
7
+ @layer css-art {
8
+ .art-circular-gallery {
9
+ --art-circular-gallery-size: 600px;
10
+ --art-circular-gallery-radius: calc(var(--art-circular-gallery-size) * 0.42);
11
+ --art-circular-gallery-card-width: calc(var(--art-circular-gallery-size) * 0.09);
12
+ --art-circular-gallery-card-border-radius: calc(var(--art-circular-gallery-size) * 0.012);
13
+ --art-circular-gallery-arc-size: 0.95;
14
+ --art-circular-gallery-arc-center: 0.275;
15
+ --art-circular-gallery-arc-start: calc(
16
+ var(--art-circular-gallery-arc-center) - var(--art-circular-gallery-arc-size) / 2
17
+ );
18
+ --art-circular-gallery-arc-shift-delta: 0.0075;
19
+ --art-circular-gallery-card-trans-duration: 1000ms;
20
+ --art-circular-gallery-card-trans-easing: linear(
21
+ 0,
22
+ 0.01 0.8%,
23
+ 0.038 1.6%,
24
+ 0.154 3.4%,
25
+ 0.781 9.7%,
26
+ 1.01 12.5%,
27
+ 1.089 13.8%,
28
+ 1.153 15.2%,
29
+ 1.195 16.6%,
30
+ 1.219 18%,
31
+ 1.224 19.7%,
32
+ 1.208 21.6%,
33
+ 1.172 23.6%,
34
+ 1.057 28.6%,
35
+ 1.007 31.2%,
36
+ 0.969 34.1%,
37
+ 0.951 37.1%,
38
+ 0.953 40.9%,
39
+ 0.998 50.4%,
40
+ 1.011 56%,
41
+ 0.998 74.7%,
42
+ 1
43
+ );
44
+
45
+ anchor-name: --art-circular-gallery-center;
46
+
47
+ /* transform at 0deg ensures this is always a containing block for position:fixed descendants */
48
+ transform: rotate(var(--art-circular-gallery-rotation));
49
+ transition: transform 700ms linear;
50
+
51
+ position: relative;
52
+ width: var(--art-circular-gallery-size);
53
+ height: var(--art-circular-gallery-size);
54
+ aspect-ratio: 1;
55
+ display: grid;
56
+ place-content: center;
57
+ font-family: sans-serif;
58
+
59
+ h1 {
60
+ margin: 0;
61
+ text-align: center;
62
+ font-size: clamp(1rem, calc(var(--art-circular-gallery-size) * 0.035), 2.5rem);
63
+ font-weight: 300;
64
+ letter-spacing: 0.05em;
65
+ /* counter-rotate so the title stays upright as the gallery rotates */
66
+ transform: rotate(calc(var(--art-circular-gallery-rotation) * -1));
67
+ }
68
+
69
+ div {
70
+ --arc-step: calc(var(--art-circular-gallery-arc-size) / 19);
71
+ --arc-shift: calc(var(--art-circular-gallery-arc-shift-delta) * var(--d, 1));
72
+ --card-offset-distance: calc(
73
+ (
74
+ var(--art-circular-gallery-arc-start) + (var(--i) - 1) * var(--arc-step) +
75
+ var(--arc-shift)
76
+ ) * 100%
77
+ );
78
+
79
+ &:has(a:hover),
80
+ &:target {
81
+ --title-opacity: 1;
82
+ }
83
+
84
+ &:target {
85
+ --zindex: 2;
86
+ --center-opacity: 1;
87
+ --center-scale: 1;
88
+ --image-outline-color: rgba(255 255 255 / 0.5);
89
+ }
90
+
91
+ /* Large image preview centered in the gallery (shown on :target) */
92
+ &::before {
93
+ content: "";
94
+ position: fixed;
95
+ position-anchor: --art-circular-gallery-center;
96
+ position-area: span-all;
97
+ transform: rotate(calc(var(--art-circular-gallery-rotation) * -1));
98
+ width: calc(var(--art-circular-gallery-size) * 0.4);
99
+ aspect-ratio: 1;
100
+ border-radius: 9in;
101
+ background: var(--bg-img);
102
+ box-sizing: border-box;
103
+ outline: 10px solid rgba(255 255 255 / 0.3);
104
+ outline-offset: -10px;
105
+ background-size: cover;
106
+ background-repeat: no-repeat;
107
+ opacity: var(--center-opacity, 0);
108
+ scale: var(--center-scale, 0);
109
+ pointer-events: none;
110
+ transition-property: scale, opacity;
111
+ transition-duration: 300ms, 150ms;
112
+ }
113
+
114
+ /* Tooltip showing the photographer's name on hover */
115
+ &::after {
116
+ content: attr(data-title);
117
+ position: fixed;
118
+ position-anchor: --art-circular-gallery-card;
119
+ position-area: center span-all;
120
+ z-index: 2;
121
+ pointer-events: none;
122
+ opacity: var(--title-opacity, 0);
123
+ transition-property: opacity, transform;
124
+ transition-duration: 150ms;
125
+ border: 1px solid rgb(255 255 255 / 0.75);
126
+ background: rgb(0 0 0 / 0.25);
127
+ backdrop-filter: blur(3px);
128
+ padding: 0.25em 1em;
129
+ border-radius: 5px;
130
+ font-size: clamp(0.55rem, calc(var(--art-circular-gallery-size) * 0.012), 0.85rem);
131
+ white-space: nowrap;
132
+
133
+ @starting-style {
134
+ opacity: 0;
135
+ }
136
+ }
137
+
138
+ /* Thumbnail card placed on the circular offset-path */
139
+ a {
140
+ position: absolute;
141
+ display: block;
142
+ width: var(--art-circular-gallery-card-width);
143
+ aspect-ratio: 4 / 6;
144
+ border-radius: var(--art-circular-gallery-card-border-radius);
145
+ border: 2px solid rgba(255 255 255 / 0.6);
146
+ offset-path: circle(var(--art-circular-gallery-radius) at 50% 50%);
147
+ offset-distance: var(--card-offset-distance);
148
+ offset-rotate: auto;
149
+ offset-anchor: 50% 0%;
150
+ transition:
151
+ offset var(--art-circular-gallery-card-trans-duration)
152
+ var(--art-circular-gallery-card-trans-easing),
153
+ scale 200ms ease;
154
+ z-index: var(--zindex, 1);
155
+ anchor-name: --art-circular-gallery-card;
156
+
157
+ &:hover {
158
+ scale: 2.5;
159
+ z-index: 3;
160
+ }
161
+
162
+ img {
163
+ width: 100%;
164
+ height: 100%;
165
+ object-fit: cover;
166
+ display: block;
167
+ border-radius: inherit;
168
+ outline: 5px solid var(--image-outline-color, transparent);
169
+ outline-offset: -5px;
170
+ transition: outline 300ms ease-in-out;
171
+ }
172
+ }
173
+ }
174
+ }
175
+
176
+ /* ============================================================
177
+ FORWARD siblings (clockwise / +d)
178
+ ============================================================ */
179
+
180
+ /* +1 */
181
+ .art-circular-gallery:has(> *:hover) > *:hover + *,
182
+ .art-circular-gallery:has(> :last-child:hover) > :nth-child(1) {
183
+ --d: 3;
184
+ }
185
+
186
+ /* +2 */
187
+ .art-circular-gallery:has(> *:hover) > *:hover + * + *,
188
+ .art-circular-gallery:has(> :last-child:hover) > :nth-child(2),
189
+ .art-circular-gallery:has(> :nth-last-child(2):hover) > :nth-child(1) {
190
+ --d: 2;
191
+ }
192
+
193
+ /* +3 */
194
+ .art-circular-gallery:has(> *:hover) > *:hover + * + * + *,
195
+ .art-circular-gallery:has(> :last-child:hover) > :nth-child(3),
196
+ .art-circular-gallery:has(> :nth-last-child(2):hover) > :nth-child(2),
197
+ .art-circular-gallery:has(> :nth-last-child(3):hover) > :nth-child(1) {
198
+ --d: 1;
199
+ }
200
+
201
+ /* +4 */
202
+ .art-circular-gallery:has(> *:hover) > *:hover + * + * + * + *,
203
+ .art-circular-gallery:has(> :last-child:hover) > :nth-child(4),
204
+ .art-circular-gallery:has(> :nth-last-child(2):hover) > :nth-child(3),
205
+ .art-circular-gallery:has(> :nth-last-child(3):hover) > :nth-child(2),
206
+ .art-circular-gallery:has(> :nth-last-child(4):hover) > :nth-child(1) {
207
+ --d: 0.5;
208
+ }
209
+
210
+ /* ============================================================
211
+ BACKWARD siblings (counter-clockwise / -d)
212
+ ============================================================ */
213
+
214
+ /* -1 */
215
+ .art-circular-gallery *:has(+ *:hover),
216
+ .art-circular-gallery:has(> :nth-child(1):hover) :nth-last-child(1) {
217
+ --d: -3;
218
+ }
219
+
220
+ /* -2 */
221
+ .art-circular-gallery *:has(+ * + *:hover),
222
+ .art-circular-gallery:has(> :nth-child(1):hover) :nth-last-child(2),
223
+ .art-circular-gallery:has(> :nth-child(2):hover) :nth-last-child(1) {
224
+ --d: -2;
225
+ }
226
+
227
+ /* -3 */
228
+ .art-circular-gallery *:has(+ * + * + *:hover),
229
+ .art-circular-gallery:has(> :nth-child(1):hover) :nth-last-child(3),
230
+ .art-circular-gallery:has(> :nth-child(2):hover) :nth-last-child(2),
231
+ .art-circular-gallery:has(> :nth-child(3):hover) :nth-last-child(1) {
232
+ --d: -1;
233
+ }
234
+
235
+ /* -4 */
236
+ .art-circular-gallery *:has(+ * + * + * + *:hover),
237
+ .art-circular-gallery:has(> :nth-child(1):hover) :nth-last-child(4),
238
+ .art-circular-gallery:has(> :nth-child(2):hover) :nth-last-child(3),
239
+ .art-circular-gallery:has(> :nth-child(3):hover) :nth-last-child(2),
240
+ .art-circular-gallery:has(> :nth-child(4):hover) :nth-last-child(1) {
241
+ --d: -0.5;
242
+ }
243
+
244
+ .art-circular-gallery-sm {
245
+ --art-circular-gallery-size: 400px;
246
+ }
247
+
248
+ .art-circular-gallery-lg {
249
+ --art-circular-gallery-size: 800px;
250
+ }
251
+ }