mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
97 lines
No EOL
2.5 KiB
HTML
97 lines
No EOL
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>Example</title>
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
<script type="text/javascript">var root = '../../'</script>
|
|
<script type="text/javascript" src="../../src/load.js"></script>
|
|
<script type="text/paperscript" canvas="canvas">
|
|
var paths = [];
|
|
|
|
function makePath() {
|
|
var path = new Path();
|
|
path.moveTo(200, 50);
|
|
path.lineTo(230, 100);
|
|
path.lineTo(250, 50);
|
|
path.lineTo(280, 110);
|
|
path.arcTo([250, 20]);
|
|
path.rotate(-5);
|
|
path.strokeWidth = 30;
|
|
paths.push(path);
|
|
path.miterLimit = 3;
|
|
return path;
|
|
}
|
|
|
|
var path = makePath();
|
|
path.selected = true;
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'butt';
|
|
path.strokeJoin = 'round';
|
|
|
|
var path = makePath().translate(150, 0);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'butt';
|
|
path.strokeJoin = 'bevel';
|
|
|
|
var path = makePath().translate(300, 0);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'butt';
|
|
path.strokeJoin = 'miter';
|
|
|
|
var path = makePath().translate(0, 150);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'square';
|
|
path.strokeJoin = 'round';
|
|
|
|
var path = makePath().translate(150, 150);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'square';
|
|
path.strokeJoin = 'bevel';
|
|
|
|
var path = makePath().translate(300, 150);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'square';
|
|
path.strokeJoin = 'miter';
|
|
|
|
var path = makePath().translate(0, 300);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'round';
|
|
path.strokeJoin = 'round';
|
|
|
|
var path = makePath().translate(150, 300);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'round';
|
|
path.strokeJoin = 'bevel';
|
|
|
|
var path = makePath().translate(300, 300);
|
|
path.strokeColor = 'black';
|
|
path.strokeCap = 'round';
|
|
path.strokeJoin = 'miter';
|
|
|
|
var path = new Path.Circle([50, 50], 35);
|
|
path.strokeColor = 'black';
|
|
path.strokeWidth = 30;
|
|
path.strokeJoin = 'round';
|
|
path.strokeCap = 'round';
|
|
// path.scale(1, 0.5);
|
|
paths.push(path);
|
|
|
|
for (var i = 0; i < paths.length; i++) {
|
|
var path = paths[i];
|
|
path.scale(1.5, new Point(300, 0));
|
|
var rect = new Path.Rectangle(path.strokeBounds);
|
|
rect.strokeWidth = 0.25;
|
|
rect.strokeColor = 'black'
|
|
rect.fillColor = null;
|
|
var rect = new Path.Rectangle(path.bounds);
|
|
rect.strokeWidth = 0.25;
|
|
rect.strokeColor = 'red'
|
|
rect.fillColor = null;
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvas" resize keepalive="true"></canvas>
|
|
</body>
|
|
</html> |