Skip to content
Snippets Groups Projects
Commit 64c7f4cd authored by Evelim Carla Ribeiro's avatar Evelim Carla Ribeiro
Browse files

modificações no arquivo task3.html, criação de novas funções

parent bb10c8a9
Branches
No related tags found
No related merge requests found
...@@ -9,19 +9,38 @@ ...@@ -9,19 +9,38 @@
<canvas id="myCanvas" width="800" height="600" style="border:1px solid #d3d3d3;"> <canvas id="myCanvas" width="800" height="600" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas> Your browser does not support the HTML5 canvas tag.</canvas>
<script> <script type="text/javascript">
var c=document.getElementById("myCanvas"); var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d"); var ctx=c.getContext("2d");
var linhas[];
function criaLinha(xOrig,xDest,yOrig,yDest) {
var l = new Object();
l.xOrig = xOrig;
l.xDest = xDest;
l.yOrig = yOrig;
l.yDest = yDest;
return l;
}
function desenhaLinha(l){
ctx.beginPath();
ctx.moveTo(l.xOrig,l.yOrig);
ctx.lineTo(l.xDest,l.yDest);
ctx.stroke();
}
function createLine(xOrig,yOrig,xDest,yDest) { function initPage(){
var line = new Object(); var l = new Object();
line.xOrig = xOrig; l.xOrig = 50;
line.yOrig = yOrig; l.xDest = 700;
line.xDest = xDest; l.yOrig = 50;
line.yDest = yDest; l.yDest = 500;
return line; //linhas.criaLinha(50,700,50,500);
desenhaLinha(l[0]);
} }
function criarPoligono(){ function criarPoligono(){
...@@ -107,8 +126,7 @@ Shape.prototype.draw = function(ctx) { ...@@ -107,8 +126,7 @@ Shape.prototype.draw = function(ctx) {
ctx.fillRect(this.x, this.y, this.w, this.h); ctx.fillRect(this.x, this.y, this.w, this.h);
} }
initPage();
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment