source: main/trunk/model-sites-dev/von-sparql/js/paper/examples/SVG Export/Gradients.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.1 KB
Line 
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="UTF-8">
5 <title>Gradients</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 stops = [new Color(1, 1, 0, 0), 'red', 'black'];
10
11 var radius = view.bounds.width * 0.4,
12 from = new Point(view.center.x),
13 to = from + [radius, 0];
14
15 var circle = new Path.Circle({
16 center: from,
17 radius: radius,
18 fillColor: {
19 stops: stops,
20 radial: true,
21 origin: from,
22 destination: to
23 },
24 strokeColor: 'black'
25 });
26
27 var from = view.bounds.leftCenter,
28 to = view.bounds.bottomRight;
29
30 var rect = new Path.Rectangle({
31 from: from,
32 to: to,
33 fillColor: {
34 stops: stops,
35 radial: false,
36 origin: from,
37 destination: to
38 },
39 strokeColor: 'black'
40 });
41
42 rect.rotate(45).scale(0.7);
43
44 document.getElementById('svg').appendChild(project.exportSVG());
45 </script>
46</head>
47<body>
48 <canvas id="canvas" width="300" height="600"></canvas>
49 <svg id="svg" width="300" height="600"></svg>
50</body>
51</html>
Note: See TracBrowser for help on using the repository browser.