source: main/trunk/model-sites-dev/von-sparql/js/paper/examples/Animated/Extruded.html@ 28914

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.9 KB
Line 
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="UTF-8">
5 <title>Extruded</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 lineGroup = new Group();
10 var lineCount = 100;
11 for (var i = 0; i < lineCount; i++) {
12 var linePath = new Path.Line([0, 0], [0, 0]);
13 lineGroup.addChild(linePath);
14 }
15 lineGroup.strokeColor = 'red';
16
17 var path1 = project.importJSON('["Path",{"pathData":"M63.39307,265.71387c10.8667,6.96631 26.4707,12.26025 43.18896,12.26025c24.79932,0 39.28857,-13.09619 39.28857,-32.04346c0,-17.27588 -10.03125,-27.58545 -35.38721,-37.05908c-30.65088,-11.146 -49.59814,-27.30713 -49.59814,-53.49902c0,-29.25732 24.2417,-50.9917 60.74365,-50.9917c18.94727,0 33.1582,4.4585 41.23877,9.19531L156.18018,133.35986c-5.85156,-3.62256 -18.39014,-8.9165 -35.38721,-8.9165c-25.63525,0 -35.3877,15.3252 -35.3877,28.14258c0,17.5542 11.42432,26.19238 37.33789,36.22314c31.76514,12.26025 47.64795,27.58545 47.64795,55.1709c0,28.979 -21.17676,54.33496 -65.48096,54.33496c-18.11133,0 -37.89502,-5.57275 -47.92578,-12.26025z"}]');
18 path1.position = view.center;
19
20 var path2 = path1.clone();
21 path1.scale(1.5);
22 path2.scale(2);
23
24 var length1 = path1.length;
25 var length2 = path2.length;
26 function onFrame(event) {
27 var vector = new Point({
28 angle: -event.count % 360,
29 length: 100
30 });
31 path1.rotate(-0.5);
32 path1.position = view.center - vector;
33
34 path2.rotate(-0.5);
35 path2.position = view.center + vector.normalize(50);
36
37 for (var i = 0; i < lineCount; i++) {
38 var path = lineGroup.children[i];
39 var l1 = (length1 / lineCount * (i + event.count / 10)) % length1;
40 var l2 = (length2 / lineCount * (i + event.count / 10)) % length2;
41 path.firstSegment.point = path1.getPointAt(l1),
42 path.lastSegment.point = path2.getPointAt(l2);
43 }
44 }
45 </script>
46</head>
47<body>
48 <canvas id="canvas" resize></canvas>
49</body>
50</html>
Note: See TracBrowser for help on using the repository browser.