-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
36 lines (36 loc) · 1.42 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./styles.css" />
<title>Scratch!</title>
</head>
<body>
<main>
<wc-scratch
brush-size="25"
brush-shape="round"
percentage-update
>
<h1>Scratch me free!</h1>
</wc-scratch>
<wc-scratch brush-size="100" scratch-color="pink">
<img src="https://images.unsplash.com/photo-1451772741724-d20990422508?q=80&w=870&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="image" />
</wc-scratch>
<wc-scratch brush-size="20">
<div style="width: 300px; height: 450px; background-color: aqua;">
<h1>Scratch me!</h1>
</div>
<img slot="scratch-source" crossorigin style="display: none;" src="https://images.unsplash.com/photo-1711619034404-665a4bc6dcd3?q=80&w=300&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="image" />
</wc-scratch>
</main>
<script type="module" src="/src/scratch/scratch.ts"></script>
<script>
const scratch = document.querySelector('wc-scratch[percentage-update]')
scratch.addEventListener('percentage-update', ({ detail }) => {
if (detail > 40) scratch.clearArea()
})
</script>
</body>
</html>