paper.js/examples/Scripts/RoundRectangle.html
2011-05-07 13:44:38 +01:00

27 lines
No EOL
761 B
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 path,
count = 0,
rect = new Rectangle([150, 150], [300, 300]);
document.currentStyle.fillColor = 'black';
function onFrame() {
if (path)
path.remove();
var size = Math.abs(Math.sin(count / 40)) * 150 + 10;
path = new Path.RoundRectangle(rect, size);
path.position = document.bounds.center;
count++;
}
</script>
</head>
<body>
<canvas id='canvas' resize></canvas>
</body>