paper.js/examples/Scripts/Shapes.html

55 lines
1.4 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<head>
2014-08-16 13:24:54 -04:00
<meta charset="UTF-8">
<title>Shapes</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper-full.js"></script>
<script type="text/paperscript" canvas="canvas">
var circle = new Shape.Circle({
center: [100, 100],
radius: 50,
fillColor: 'red'
});
2014-08-16 13:24:54 -04:00
var ellipse = new Shape.Ellipse({
center: [100, 200],
radius: [50, 25],
fillColor: 'blue',
strokeColor: 'black',
strokeWidth: 10,
rotation: 20
});
2014-08-16 13:24:54 -04:00
var rect = new Shape.Rectangle({
center: [100, 300],
size: [100, 50],
fillColor: 'green',
strokeColor: 'black',
strokeWidth: 10,
rotation: -20
});
2014-08-16 13:24:54 -04:00
var roundRect = new Shape.Rectangle({
center: [100, 400],
size: [50, 100],
radius: [15, 20],
fillColor: 'orange',
strokeColor: 'black',
strokeWidth: 10,
rotation: 20
});
2014-08-16 13:24:54 -04:00
[circle, ellipse, rect, roundRect].forEach(function(shape) {
var path = shape.toPath();
path.position += [200, 0];
var shape2 = path.toShape();
shape2.position += [200, 0];
})
</script>
</head>
<body>
2014-08-16 13:24:54 -04:00
<canvas id="canvas" resize></canvas>
</body>
</html>