Last change
on this file since 28914 was 28914, checked in by ak19, 10 years ago |
Supporting javascript libraries and bespoke code written by Steffan to support the von-sparql user interface
|
File size:
1.2 KB
|
Line | |
---|
1 | <!DOCTYPE html>
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <meta charset="UTF-8">
|
---|
5 | <title>Lines</title>
|
---|
6 | <link rel="stylesheet" href="../css/style.css">
|
---|
7 | <script type="text/javascript" src="../../dist/paper.js"></script>
|
---|
8 | <script type="text/paperscript" canvas="canvas">
|
---|
9 | var amount = 45;
|
---|
10 | for (var i = 0; i < amount; i++) {
|
---|
11 | var path = new Path({
|
---|
12 | fillColor: {
|
---|
13 | hue: 1,
|
---|
14 | saturation: 1,
|
---|
15 | brightness: Math.random()
|
---|
16 | },
|
---|
17 | closed: true
|
---|
18 | });
|
---|
19 | }
|
---|
20 |
|
---|
21 | var position = view.center;
|
---|
22 | var mousePos = view.center;
|
---|
23 | var children = project.activeLayer.children;
|
---|
24 |
|
---|
25 | function iterate(count) {
|
---|
26 | var delta = mousePos - position;
|
---|
27 | position += delta / 10;
|
---|
28 | for (var i = 1; i < amount; i++) {
|
---|
29 | var path = children[i];
|
---|
30 | var length = Math.abs(Math.sin(i + count / 40) * 300);
|
---|
31 | path.segments = [
|
---|
32 | position + delta / 1.5,
|
---|
33 | position + { angle: i / amount * 360, length: length },
|
---|
34 | position + { angle: (i + 1) / amount * 360, length: length }
|
---|
35 | ];
|
---|
36 | path.fillColor.hue = count - length;
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | function onFrame(event) {
|
---|
41 | iterate(event.count);
|
---|
42 | }
|
---|
43 |
|
---|
44 | function onMouseMove(event) {
|
---|
45 | iterate();
|
---|
46 | mousePos = event.point;
|
---|
47 | }
|
---|
48 | </script>
|
---|
49 | </head>
|
---|
50 | <body style="background:black">
|
---|
51 | <canvas id="canvas" resize></canvas>
|
---|
52 | </body>
|
---|
53 | </html> |
---|
Note:
See
TracBrowser
for help on using the repository browser.