-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_objects.html
More file actions
53 lines (42 loc) · 1.14 KB
/
test_objects.html
File metadata and controls
53 lines (42 loc) · 1.14 KB
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
<!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.9.15/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
var circs = [];
for(var i=0;i<5;i++){
var c = new ExampleCircle(new Point(100+(100*i),100),50);
circs.push(c);
}
function onFrame(event) {
for(var i=0;i<circs.length;i++){
circs[i].update();
}
}
function ExampleCircle(pt,radius)
{
this.circle = new Shape.Circle(pt, radius);
this.circle.fillColor = '#444444';
this.circle.strokeColor = '#111111';
this.inc = Math.random();
ExampleCircle.prototype.testtest = function(){
console.log("this->",this);
}
this.testtest();
}
ExampleCircle.prototype.update = function(){
var xp = this.circle.radius;
xp += this.inc;
if (xp > 300) this.inc = -Math.abs(this.inc);
if (xp < 0) this.inc = Math.abs(this.inc);
this.circle.radius = xp;
}
</script>
</head>
<body>
<canvas id="canvas" resize></canvas>
</body>
</html>