-
Notifications
You must be signed in to change notification settings - Fork 32
/
index.html
70 lines (70 loc) · 1.98 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
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
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta name="viewport" content="width=device-width">
<meta charset="UTF-8">
<title>Canvas masking</title>
<style type="text/css">
html {
background: powderblue;
height: 100%;
font-family: Helvetica, Arial, sans-serif;
margin: 0;
padding: 0;
}
body {
margin: 0;
padding: 2em;
background: linear-gradient(to bottom, powderblue, #369);
background: -webkit-linear-gradient(powderblue, #369);
/* ^ oh the joy of having to add extra crap for webkit */
}
h1, h2 {
font-size: 20px;
font-weight: normal;
color: #fff;
text-shadow: 0px 1px 1px #000;
}
h1 {
font-size: 24px;
margin-top: 0 ;
}
p {font-size: 18px; color: #030;}
code {background: #eee; color: #000; padding: 2px 5px;}
pre {
font-size: 18px;
}
p a {
display: inline-block;
background: lime;
color: #000;
text-decoration: none;
padding: 2px 5px;
border-radius: 10px;
}
</style>
</head>
<body>
<header>
<h1>Image masking with <canvas></h1>
<p>This is a small demo how to mask images with canvas. Simply add the <code>canvasmask.js</code> file, add a class <code>mask</code> to the images you want to mask and their mask PNG file as a <code>data-mask</code>. For example:</p>
<pre>
<img src="red-panda.jpg" alt="Red panda" class="mask" data-mask="centerblur.png">
<img src="red-panda.jpg" alt="Red panda" class="mask" data-mask="star.png">
</pre>
<p><a href="https://github.com/codepo8/canvas-masking">Get the source on GitHub</a></p>
</header>
<section>
<h2>Results</h2>
<img src="red-panda.jpg" alt="Red panda" class="mask" data-mask="centerblur.png">
<img src="red-panda.jpg" alt="Red panda" class="mask" data-mask="star.png">
</section>
<section>
<h2>The Image and masks</h2>
<img src="red-panda.jpg" alt="Red panda">
<img src="centerblur.png" alt="center blur">
<img src="star.png" alt="star">
</section>
<script src="canvasmask.js"></script>
</body>
</html>