From 64c7f4cda28a47c515186254fa02d03aca74432e Mon Sep 17 00:00:00 2001 From: Evelim Carla Ribeiro <ecr10@inf.ufpr.br> Date: Tue, 15 Apr 2014 00:55:54 -0300 Subject: [PATCH] =?UTF-8?q?modifica=C3=A7=C3=B5es=20no=20arquivo=20task3.h?= =?UTF-8?q?tml,=20cria=C3=A7=C3=A3o=20de=20novas=20fun=C3=A7=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Evelim Carla Ribeiro <ecr10@inf.ufpr.br> --- task3.html | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/task3.html b/task3.html index 7a9d6fe..ff39022 100644 --- a/task3.html +++ b/task3.html @@ -9,19 +9,38 @@ <canvas id="myCanvas" width="800" height="600" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> -<script> +<script type="text/javascript"> var c=document.getElementById("myCanvas"); 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){ -function createLine(xOrig,yOrig,xDest,yDest) { - var line = new Object(); - line.xOrig = xOrig; - line.yOrig = yOrig; - line.xDest = xDest; - line.yDest = yDest; - return line; + ctx.beginPath(); + ctx.moveTo(l.xOrig,l.yOrig); + ctx.lineTo(l.xDest,l.yDest); + ctx.stroke(); + +} + +function initPage(){ + var l = new Object(); + l.xOrig = 50; + l.xDest = 700; + l.yOrig = 50; + l.yDest = 500; + //linhas.criaLinha(50,700,50,500); + desenhaLinha(l[0]); } function criarPoligono(){ @@ -107,8 +126,7 @@ Shape.prototype.draw = function(ctx) { ctx.fillRect(this.x, this.y, this.w, this.h); } - - +initPage(); </script> -- GitLab