-
Notifications
You must be signed in to change notification settings - Fork 0
/
mask_test.html
60 lines (50 loc) · 1.53 KB
/
mask_test.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Masking in Paper.js</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="lib-0.22/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
var circle = new Path.Circle(new Point(100,100), 50);
circle.fillColor = '#444444';
var circle2 = new Path.Circle(new Point(130,100), 49);
circle2.strokeColor = '#111111';
var style = {
font: "American Typewriter, Courier, typewriter",
justification: 'center',
fillColor: '#111111',
fontSize: 50
};
var text1 = new PointText(new Point(100,100));
text1.characterStyle = style;
text1.content = "1";
var text2 = new PointText(new Point(200,100));
text2.characterStyle = style;
text2.content = "2";
var text3 = new PointText(new Point(300,100));
text3.characterStyle = style;
text3.content = "3";
//var circle3 = new Path.Circle(new Point(0,20),30);
//circle3.fillColor = '#111111';
var agroup = new Group(circle,circle2,text1,text2,text3);
agroup.position = new Point(100,200);
agroup.clipped = true;
//circle.clipMask = false;
//circle3.clipped = true;
//circle3.clipMask = true;
inc = 0.6;
function onFrame(event) {
var xp = circle.position.x;
xp += inc;
if (xp > 300) inc = -Math.abs(inc);
if (xp < 0) inc = Math.abs(inc);
circle.position.x = xp;
circle2.position = circle.position;
}
</script>
</head>
<body>
<canvas id="canvas" resize></canvas>
</body>
</html>