2013-10-14 13:57:28 -04:00
|
|
|
<!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">
|
2014-04-07 06:01:56 -04:00
|
|
|
<!-- IE 9: display inline SVG -->
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9">
|
2014-08-16 13:24:54 -04:00
|
|
|
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
|
|
<script type="text/paperscript" canvas="canvas">
|
|
|
|
var rect = new Shape.Rectangle({
|
|
|
|
point: [200, 100],
|
|
|
|
size: [200, 300],
|
|
|
|
fillColor: 'red'
|
|
|
|
});
|
|
|
|
rect.rotate(40);
|
2013-10-14 13:57:28 -04:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
var circle = new Shape.Circle({
|
|
|
|
center: [200, 300],
|
|
|
|
radius: 100,
|
|
|
|
fillColor: 'green'
|
|
|
|
});
|
|
|
|
circle.scale(0.5, 1);
|
|
|
|
circle.rotate(40);
|
2013-10-14 13:57:28 -04:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
var ellipse = new Shape.Ellipse({
|
|
|
|
point: [300, 300],
|
|
|
|
size: [100, 200],
|
|
|
|
fillColor: 'blue'
|
|
|
|
});
|
|
|
|
ellipse.rotate(-40);
|
2013-10-14 13:57:28 -04:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
var rect = new Shape.Rectangle({
|
|
|
|
point: [250, 20],
|
|
|
|
size: [200, 300],
|
|
|
|
radius: [40, 20],
|
|
|
|
fillColor: 'yellow'
|
|
|
|
});
|
|
|
|
rect.rotate(-20);
|
|
|
|
document.body.appendChild(project.exportSVG());
|
2013-10-14 13:57:28 -04:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
var prev = null;
|
|
|
|
function onMouseMove(event) {
|
|
|
|
if (prev)
|
|
|
|
prev.selected = false;
|
|
|
|
var result = project.hitTest(event.point);
|
|
|
|
if (result) {
|
|
|
|
var item = result.item;
|
|
|
|
item.selected = true;
|
|
|
|
prev = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2013-10-14 13:57:28 -04:00
|
|
|
</head>
|
|
|
|
<body>
|
2014-08-16 13:24:54 -04:00
|
|
|
<canvas id="canvas" width="500" height="500"></canvas>
|
2013-10-14 13:57:28 -04:00
|
|
|
</body>
|
2014-04-06 07:44:19 -04:00
|
|
|
</html>
|