-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtraindo_Funcoes.html
More file actions
41 lines (32 loc) · 1.03 KB
/
Extraindo_Funcoes.html
File metadata and controls
41 lines (32 loc) · 1.03 KB
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
<canvas id="tela" width="600" height="400"></canvas>
<script type="text/javascript">
var desenhaQuadradoVerde = function(x,y){
var tela = document.getElementById("tela");
var c = tela.getContext("2d");
c.fillStyle = "green";
c.fillRect(x,y,50,50);
c.strokeStyle="black";
c.strokeRect(x,y,50,50);
}
var desenhaQuadradoVermelho = function(x,y){
var tela = document.getElementById("tela");
var c = tela.getContext("2d");
c.fillStyle = "red";
c.fillRect(x,y,50,50);
c.strokeStyle="black";
c.strokeRect(x,y,50,50);
}
var desenhaBolaAzul = function(x,y){
var tela = document.getElementById("tela");
var c = tela.getContext("2d");
c.fillStyle = "blue";
c.beginPath();
c.arc(x,y,25,0,2*Math.PI);
c.fill();
}
for(var x = 0; x < 600; x = x + 50){
desenhaQuadradoVerde(x, 0);
desenhaQuadradoVermelho(x, 50);
desenhaBolaAzul(x, 100);
}
</script>