paper
Version:
The Swiss Army Knife of Vector Graphics Scripting
35 lines (32 loc) • 1.03 kB
HTML
<html>
<head>
<meta charset="UTF-8">
<title>Gradients</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper-full.js"></script>
<script type="text/paperscript" canvas="canvas1">
var path = new Path.Circle({
center: view.center,
radius: view.bounds.height * 0.4
});
path.fillColor = {
stops: ['yellow', 'red', 'black'],
radial: true,
origin: path.position,
destination: path.bounds.rightCenter
}
var symbol = new SymbolDefinition(path);
symbol.place(view.center);
window._json = project.exportJSON();
console.log(window._json);
</script>
<script type="text/paperscript" canvas="canvas2">
project.importJSON(window._json);
</script>
</head>
<body>
<canvas id="canvas1" width="500" height="500"></canvas>
<canvas id="canvas2" width="500" height="500"></canvas>
</body>
</html>