Newer
Older
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
<script>
const { scale = 1, scrollDirection = undefined, class: className = undefined, ...props } = $props();
let height = $state(0)
let width = $state(0)
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 {width/scale} {height/scale}"
width="100%"
height="100%"
class={className}
bind:clientHeight={height}
bind:clientWidth={width}
{...props}
>
<defs>
<pattern id="checks" patternUnits="userSpaceOnUse" width="16" height="16" class={scrollDirection ? ['scroll', scrollDirection] : []}>
<rect width="16" height="16" fill="var(--pattern-light)" />
<rect width="8" height="8" x="0" y="0" fill="var(--pattern-dark)" />
<rect width="8" height="8" x="8" y="8" fill="var(--pattern-dark)" />
</pattern>
</defs>
<rect width="100%" height="100%" fill="url(#checks)" />
</svg>
<style>
.scroll {
animation: scroll-up-left 2s linear infinite;
}
.scroll.up-left {
animation-name: scroll-up-left;
}
@keyframes scroll-up-left {
0% {
transform: translate3d(0px, 0px, 0px);
}
100% {
transform: translate3d(-16px, -16px, 0px);
}
}
</style>