Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Latest commit

 

History

History
30 lines (24 loc) · 1.39 KB

File metadata and controls

30 lines (24 loc) · 1.39 KB

p5

.. p5:: first-demo
    :width: 250
    :height: 250
    :autoplay:


    function setup() {
      createCanvas(200, 200);
    }

    function draw() {
      background(255);
      fill(0);
      ellipse(mouseX, mouseY, 50, 50);
    } 

Everything inside of the p5 directive, including whitespace, will be included in the page and rendered with the p5.js-widget.

  • `id` Must be unique in the document.
  • `autoplay` If present, the sketch will start playing automatically.
  • `height` The height of the widget (and consequently the sketch preview pane too) defaults to 300px and can be changed via the height attribute.
  • `width` The width of the sketch preview pane defaults to 150px and can be set via the width attribute.