block by dribnet 02a680472b61578aa1d9d2382ca12a36

hello p5js (p5js bl.ocks.org template)

Full Screen

Hello p5js blocks

This is the canonical p5.js “Make Circles” sketch formatted as a p5.js block. Useful as a starting point to fork and customize.

index.html

<head>
    <script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.8/p5.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.8/addons/p5.dom.js"></script>
    <script language="javascript" type="text/javascript" src=".purview_helper.js"></script>
    <script language="javascript" type="text/javascript" src="sketch.js"></script>
    <style> body {padding: 0; margin: 0;} </style>
</head>

<body style="background-color:white">
</body>

sketch.js

function setup () {
  createCanvas(960, 500);
}

function draw () {
  if (mouseIsPressed) {
    fill(0);
  }
  else {
    fill(255);
  }
  ellipse(mouseX, mouseY, 80, 80);
}

function keyTyped() {
  if (key == '!') {
    saveBlocksImages();
  }
}