-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample_mask.html
27 lines (27 loc) · 1003 Bytes
/
example_mask.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>img.js - Example mask</title>
<script src="build/img.js"></script>
<script>
window.onload = function () {
var img1 = 'images/img1.jpg';
var img2 = 'images/img2.jpg';
img.loadImages([img1, img2], function (images) {
var iCanvas = new img.ImageCanvas(600, 450);
var layer = iCanvas.addLayer(images[img1]);
layer.addFilter('rgbAdjust', {r: 0.25, g: 0.25});
layer = iCanvas.addLayer(images[img2]);
layer.addFilter('rgbAdjust', {r: 0.30, g: 0.20, b: 0.35});
layer.opacity = 0.5;
var mask = layer.mask.addLayer({startColor: 'white', endColor: 'black', type: 'radial', spread: 0.97});
mask.width = mask.height = 360;
document.body.appendChild(iCanvas.render());
});
};
</script>
</head>
<body id="root">
</body>
</html>