Public
Edited
Jan 19, 2024
7 forks
Insert cell
Insert cell
Insert cell
Insert cell
import {p5} from "@thometnanni/p5";
Insert cell
Insert cell
Insert cell
p5((s) => {
let image;
let height;
s.preload = function () {
image = s.loadImage(imageURL);
};

s.setup = function () {
let ratio = width / image.width
height = image.height * ratio
s.createCanvas(width, height);
image.resize(width, height)
};

s.draw = function () {
s.image(image, 0, 0);
};
})
Insert cell
Insert cell
p5((s) => {
s.preload = function () {};

s.setup = function () {};

s.draw = function () {};
})
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
p5((s) => {
s.preload = function () {};

s.setup = function () {};

s.draw = function () {};
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more