Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiorosa1 authored Feb 27, 2019
1 parent d7a48a3 commit cacbf09
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
35 changes: 34 additions & 1 deletion Learning HTML Canvas/canvas-resize/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,37 @@ canvas.height = window.innerHeight;

var c = canvas.getContext('2d');

console.log(canvas);
c.fillStyle = 'rgba(240, 200, 0, 0.8)';
c.fillRect(100,100,100,100);
c.fillRect(200,300,100,100);
c.fillRect(300,500,100,100);
console.log(canvas);


// Line
c.beginPath();
c.moveTo(50,300);
c.lineTo(300,100);
c.lineTo(400,300);
c.strokeStyle = '#ffff';
c.stroke();

// Arc/ Circle
c.beginPath();
c.arc(300, 300, 30, 0 , Math.PI *2, false);
c.strokeStyle = 'blue';
c.stroke();


var i =0;

while(i< 5){
var x = Math.random() * window.innerWidth;
var y = Math.random() * window.innerHeight;
c.beginPath();
c.arc(x, y, 30, 0 , Math.PI *2, false);
c.strokeStyle = 'blue';
c.stroke();

i++;
}
1 change: 1 addition & 0 deletions Learning HTML Canvas/canvas-resize/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
}
body {
margin: 0;
background-color: red;
}
</style>
</head>
Expand Down

0 comments on commit cacbf09

Please sign in to comment.