Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>

  <link rel="stylesheet" href="style.css" />

  <div class="wrapper">
    <div class="slideContainer">
      <input type="range" min="1" max="800" value="50" class="slider" id="myRange">
    <canvas id="canvas"></canvas>



                body {
  background-color: lightgray;
  display: flex;
  justify-content: center;
  align-items: center;
.slideContainer {
  position: fixed;
  right: 30px;
  top: 30px;
  background-color: lightblue;
  z-index: 20;
canvas {
  border: 1px dotted red;
  padding: 80px;
  background-color: lightgray;
  transform: scale(0.5);


                var canvas = document.querySelector("canvas");

canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

canvas.width = 1600;
canvas.height = 800;

var ctx = canvas.getContext("2d");

// 1. Make a center point
// 2. Draw lines jutting from center
// 3. Draw a line parallel to canvas bottom
// 4. Draw an adjoining item upward

// x, y
// right, down

// Nomenclature
// x0a
// coordinate type, vanishingPt#, endPtName

// Vanishing point 0
var x0 = 400;
var y0 = 400;

// Vanishing point end 0a
var x0a = 0;
var y0a = 2 * y0;

// Vanishing point end 0b
var x0b = 2 * x0;
var y0b = 2 * y0;

// Define delta
var delta = 700;

function init() {
  console.log(delta, "delta");
  console.log(x0b, "x0b");
  console.log(y0b, "y0b");
  console.log(x0, "x0");
  console.log(y0, "y0");
  // First Line
  ctx.moveTo(x0, y0);
  ctx.lineTo(x0a, y0a);
  ctx.strokeStyle = 'red';

  // Second Line
  ctx.moveTo(x0, y0);
  ctx.lineTo(x0b, x0b);
  ctx.strokeStyle = 'green';

  // // House based on second Line
  ctx.moveTo(x0b, y0b); // starting point
  ctx.lineTo(x0b + delta, y0b); // right x+100
  ctx.lineTo(x0b + delta, y0b - delta); // up y-100
  ctx.lineTo(x0b, y0b - delta); // left x-100
  ctx.lineTo(x0b, y0b); // down y+100
  ctx.lineTo(x0b, y0b - delta); // back up y-100
  ctx.lineTo(x0, y0);
  ctx.lineTo(x0b + delta, y0b - delta);
  ctx.strokeStyle = 'blue';


var slider = document.getElementById("myRange");

slider.oninput = function () {
  ctx.clearRect(0, 0, canvas.width, canvas.height); // add this line
  delta = +this.value;
  requestAnimationFrame(init()); // redraw everything