-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanvas-hola.html
executable file
·68 lines (40 loc) · 1010 Bytes
/
canvas-hola.html
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>dibujar canvas</title>
</head>
<body>
<canvas id='hola' width='130px' height='100px' style='border:1px solid black'>
</canvas>
<script type='text/javascript'>
var c=document.getElementById('hola');
var cxt=c.getContext('2d');
// dibujar
cxt.moveTo(10,10); //posicion
cxt.lineTo(10,90); // dibujar la linea dentro de el parametro ya mencionados arriba
cxt.lineTo(10,50);
cxt.lineTo(30,50);
cxt.lineTo(30,10);
cxt.lineTo(30,90);
// ya dibujamos la h
cxt.moveTo(40,10); //posicion pixel
cxt.lineTo(40,90);
cxt.lineTo(60,90);
cxt.lineTo(60,10);
cxt.lineTo(40,10);
cxt.moveTo(70,10);
cxt.lineTo(70,90);
cxt.lineTo(90,90);
cxt.moveTo(100,90);
cxt.lineTo(100,10);
cxt.lineTo(120,10);
cxt.lineTo(120,90);
cxt.lineTo(120,50); // volver atras
cxt.lineTo(100,50);
// x cresen hacia la derecha
// y hacia abajo
cxt.stroke();
</script>
</body>
</html>