Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
task 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evelim Carla Ribeiro
task 3
Commits
b21d9c31
Commit
b21d9c31
authored
11 years ago
by
Evelim Carla Ribeiro
Browse files
Options
Downloads
Patches
Plain Diff
primeiro commit
parents
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
task3.html
+55
-0
55 additions, 0 deletions
task3.html
with
55 additions
and
0 deletions
task3.html
0 → 100644
+
55
−
0
View file @
b21d9c31
<!DOCTYPE html>
<html>
<body>
<canvas
id=
"myCanvas"
width=
"700"
height=
"400"
style=
"border:1px solid #d3d3d3;"
>
Your browser does not support the HTML5 canvas tag.
</canvas>
<script>
var
c
=
document
.
getElementById
(
"
myCanvas
"
);
var
ctx
=
c
.
getContext
(
"
2d
"
);
ctx
.
beginPath
();
var
y1
=
20
;
var
y2
=
100
;
var
x1
=
20
;
var
x2
=
100
;
ctx
.
moveTo
(
x1
,
y1
);
//posicao inicial
ctx
.
lineTo
(
x2
,
y1
);
<!--
ctx
.
moveTo
(
x2
,
y1
);
-->
<!--
ctx
.
lineTo
(
x2
,
y2
);
-->
ctx
.
moveTo
(
x2
,
y2
);
ctx
.
lineTo
(
x1
,
y2
);
ctx
.
moveTo
(
x1
,
y2
);
ctx
.
lineTo
(
x1
,
y1
);
<!--
penta
-->
ctx
.
moveTo
(
150
,
60
);
ctx
.
lineTo
(
x2
,
y2
);
ctx
.
moveTo
(
x2
,
y1
);
ctx
.
lineTo
(
150
,
60
);
function
Shape
(
x
,
y
,
w
,
h
,
fill
)
{
// This is a very simple and unsafe constructor.
// All we're doing is checking if the values exist.
// "x || 0" just means "if there is a value for x, use that. Otherwise use 0."
this
.
x
=
x
||
0
;
this
.
y
=
y
||
0
;
this
.
w
=
w
||
1
;
this
.
h
=
h
||
1
;
this
.
fill
=
fill
||
'
#AAAAAA
'
;
}
// Draws this shape to a given context
Shape
.
prototype
.
draw
=
function
(
ctx
)
{
ctx
.
fillStyle
=
this
.
fill
;
ctx
.
fillRect
(
this
.
x
,
this
.
y
,
this
.
w
,
this
.
h
);
}
ctx
.
stroke
();
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment