2011-04-26 10:46:36 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2014-08-16 13:24:54 -04:00
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Stars</title>
|
|
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
|
|
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
|
|
<script type="text/paperscript" canvas="canvas">
|
|
|
|
function onMouseDown(event) {
|
|
|
|
var hue = Math.random() * 360;
|
|
|
|
project.currentStyle.fillColor = {
|
|
|
|
hue: hue,
|
|
|
|
saturation: 1,
|
|
|
|
brightness: 1
|
|
|
|
};
|
|
|
|
}
|
2011-07-07 10:09:02 -04:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
function onMouseDrag(event) {
|
|
|
|
var delta = event.point - event.downPoint;
|
|
|
|
var radius = delta.length;
|
|
|
|
var points = 5 + Math.round(radius / 50);
|
|
|
|
var path = new Path.Star({
|
|
|
|
center: event.downPoint,
|
|
|
|
points: points,
|
|
|
|
radius1: radius / 2,
|
|
|
|
radius2: radius
|
|
|
|
});
|
|
|
|
path.rotate(delta.angle);
|
|
|
|
// Remove the path automatically before the next mouse drag
|
|
|
|
// event:
|
|
|
|
path.removeOnDrag();
|
|
|
|
}
|
|
|
|
</script>
|
2011-04-26 10:46:36 -04:00
|
|
|
</head>
|
|
|
|
<body>
|
2014-08-16 13:24:54 -04:00
|
|
|
<canvas id="canvas" resize></canvas>
|
2011-05-30 18:27:39 -04:00
|
|
|
</body>
|
2014-04-06 07:44:19 -04:00
|
|
|
</html>
|