mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a42b1e37ed
1 changed files with 30 additions and 0 deletions
30
examples/Scripts/Fitting.html
Normal file
30
examples/Scripts/Fitting.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!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" src="../../dist/paper.js"></script>
|
||||
<script type="text/paperscript" canvas="canvas">
|
||||
var blackPath = new Path.Circle(new Point(), 10);
|
||||
blackPath.fillColor = 'black';
|
||||
|
||||
var redPath = new Path.Circle(new Point(), 10);
|
||||
redPath.fillColor = 'red';
|
||||
|
||||
function onResize() {
|
||||
// Whenever the view is resized:
|
||||
|
||||
// Fit the black path, so it covers the view:
|
||||
blackPath.fitBounds(view.bounds, true);
|
||||
|
||||
// Fit the red path, so it fits inside the view:
|
||||
redPath.fitBounds(view.bounds);
|
||||
}
|
||||
onResize();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" resize keepalive="true"></canvas>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue