File: 02-basic.html

package info (click to toggle)
python-pattern 2.6%2Bgit20150109-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,672 kB
  • sloc: python: 53,865; xml: 11,965; ansic: 2,318; makefile: 94
file content (27 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!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>