Skip to content

Commit

Permalink
transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
f2acode committed Nov 1, 2017
1 parent 5ae54f8 commit 2a91ec4
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ window.onload = function () {

/* ======== getting canvas */

// TODO create an object with the name of the example inside the array

// fillStyle and fillRect()

var myCanvas = document.getElementById("myCanvas");
Expand Down Expand Up @@ -265,7 +267,18 @@ window.onload = function () {
canvas[22].context.strokeText(isPointInPath, 10, 40);
canvas[22].context.stroke();

//
// scale()
createCanvasBase();

canvas[23].context.strokeRect(5, 5, 10, 10);
canvas[23].context.scale(2, 2);
canvas[23].context.strokeRect(5, 5, 10, 10);

// rotate()
createCanvasBase();

canvas[24].context.rotate(20 * Math.PI / 180);
canvas[24].context.fillRect(5, 10, 15, 20);

canvas.forEach(function(canva) {
document.body.appendChild(canva.element);
Expand Down

0 comments on commit 2a91ec4

Please sign in to comment.