2011-02-21 08:31:26 -05:00
|
|
|
<!DOCTYPE html>
|
2011-02-08 07:16:43 -05:00
|
|
|
<html>
|
|
|
|
<head>
|
2014-08-16 13:24:54 -04:00
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Wave</title>
|
|
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
|
|
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
|
|
<script type="text/paperscript" canvas="canvas">
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Values
|
2011-02-08 07:16:43 -05:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
tool.minDistance = 10;
|
2011-02-08 07:16:43 -05:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
var values = {
|
|
|
|
curviness: 0.5,
|
|
|
|
distance: tool.minDistance,
|
|
|
|
offset: 10,
|
|
|
|
mouseOffset: true
|
|
|
|
};
|
2011-03-04 06:38:38 -05:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Mouse handling
|
2011-03-04 06:38:38 -05:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
var path;
|
|
|
|
function onMouseDown(event) {
|
|
|
|
path = new Path({
|
|
|
|
strokeColor: '#000000'
|
|
|
|
});
|
|
|
|
}
|
2011-03-04 06:38:38 -05:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
var mul = 1;
|
|
|
|
function onMouseDrag(event) {
|
|
|
|
var step = event.delta.rotate(90 * mul);
|
2011-03-04 06:38:38 -05:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
if (!values.mouseOffset)
|
|
|
|
step.length = values.offset;
|
2011-03-04 06:38:38 -05:00
|
|
|
|
2014-08-16 13:24:54 -04:00
|
|
|
path.add({
|
|
|
|
point: event.point + step,
|
|
|
|
handleIn: -event.delta * values.curviness,
|
|
|
|
handleOut: event.delta * values.curviness
|
|
|
|
});
|
|
|
|
mul *= -1;
|
|
|
|
}
|
|
|
|
</script>
|
2011-02-08 07:16:43 -05: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>
|