Problem Set 04:

Due 10-11 (7 days)

Reading:

Reference:

ps-04

The purpose of this weeks problem set is to get familiar with drawing with the Canvas. Also to practice working variables, loops and control structures.

b – 'broken grid':

b – '33 non-intersecting lines'

c – '333 connected lines'

c (stretch) – 'Sketches → rules → Sketches':

Source of ps-03 starter:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>canvas starter document</title>
    <style media="screen">
      body {
        font-family: 'helvetica', sans-serif;
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0px;
        bottom: 0px;
        left: 0px;
        right: 0px;
      }
      canvas {
        border: 1px solid hsl(0,10%,90%);
        width: auto;
        height: 50%;
      }
    </style>
  </head>

  <body>
    <canvas id="canvas" width="500" height="500"></canvas>
  </body>

  <script type="text/javascript">
    var canvas = document.getElementById('canvas');
    var drawingPad = canvas.getContext('2d');
    drawingPad.fillStyle = "hsla(0,10%,10%,1)";
    drawingPad.fillRect(0, 0, 20, 20);
  </script>

</html>