paper.js/examples/Scripts/Resize.html

43 lines
1.2 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
2014-08-16 13:24:54 -04:00
<meta charset="UTF-8">
<title>Resize</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper-full.js"></script>
<script type="text/paperscript" canvas="canvas">
var redPath = new Path.Circle({
center: view.center,
radius: 5,
fillColor: 'red'
});
2014-08-16 13:24:54 -04:00
var whitePath = new Path.Circle({
center: view.center,
radius: 5,
fillColor: 'white'
});
2014-08-16 13:24:54 -04:00
var text = new PointText({
content: 'Resize your window',
justification: 'center',
point: view.center
});
2014-08-16 13:24:54 -04:00
function onResize(event) {
// Resize the red circle to fill the bounds of the view:
redPath.fitBounds(view.bounds, true);
2014-08-16 13:24:54 -04:00
// Resize the white circle to fit within the bounds of the view:
whitePath.fitBounds(view.bounds, false);
2014-08-16 13:24:54 -04:00
// Move the text to the center of the view:
text.position = view.bounds.center;
}
</script>
</head>
<body>
2014-08-16 13:24:54 -04:00
<canvas id="canvas" resize></canvas>
</body>
</html>