You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
822 B
HTML

<!doctype html>
<html>
<head>
<title>canvas.js | basics (2)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../pattern/canvas.js"></script>
</head>
<body>
<script type="text/canvas">
// You don't need to define a <canvas> explicitly.
// For each <script type="text/canvas"> a 500 x 500 <canvas> is automatically generated
// and inserted in the document right before the <script> element.
// Variations include:
// <script type="text/canvas" canvas="[id]">
// <script type="text/canvas" loop="false">
function setup(canvas) {
canvas.size(500, 500);
}
function draw(canvas) {
canvas.clear();
translate(250, 250);
rotate(canvas.frame);
rect(-150, -150, 300, 300, {fill: color(1,0,0,1)});
}
</script>
</body>
</html>