css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <link href="https://fonts.googleapis.com/css?family=Oswald:300,500,600,700" rel="stylesheet">
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/255459/fabric.js"></script>
<!--   <script src="https://unpkg.com/vue/dist/vue.js"></script> -->
<canvas id="canvas" class = "theCanvas" width="800" height="250" style=""></canvas>
            
          
!
            
              body {
  background: #fcfcfc;
  font-size: 16px;
  font-family: 'Oswald', sans-serif;
  color: #444;
  border: 5px solid #444;
  width: 95%;
  height: 250px;
  margin-left: auto;
  margin-right: auto;
  text-align:center;
  
}

.container{
  position: relative;
 margin-left: auto;
    margin-right: auto;
    width: 80%;
}
#canvasTwo{
  font-family: 'Oswald', sans-serif;

}

h1 {
  font-size: 260%;
  line-height: 1.2em;
}
            
          
!
            
              var poem = ["A Language", "That Can", "Be Interacted", "With"];

//I really want a simple equation that counts the number of characters and multiplies that by x where x is the number per character that a string would take up on a grid
var distances = [20, 210, 360, 590];
var canvas = new fabric.Canvas('canvas');
// var instructions = new fabric.Text("Click on any of the words to manipulate them ", {
// fontFamily:  'Oswald',
// fontSize:20,
// fill: '#444',
//   left: 10,
//   hasControls: true,
//   hasBorders: true,
//   top: 300});

// canvasTwo.add(instructions)

var yDown = 50;
var xAcross = 120;
//how to I update this so that each time a new thing is added to the array it redraws or draws the new One
//It would be the equivelant of update in D3
for (i = 0; i < poem.length; i++) {
  var text = new fabric.Text(poem[i], {
    fontFamily: 'Oswald',
    fontSize: 42,
    fill: '#444',
    left: distances[i]+40,
    // top: 50*i });
    top: yDown
  });

  // xAcross = distance[i];
  // yDown = yDown+10;

  canvas.add(text);
    //     text.hasControls = true;
    // text.hasBorder = true;
}

text.hasControls = true;
text.hasBorder = true;
canvas.selectionColor = 'rgba(0,255,0,0.3)';
canvas.selectionBorderColor = 'red';
canvas.selectionLineWidth = 5;
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console