Public
Edited
Apr 27, 2024
Insert cell
Insert cell
Insert cell
viewof rotate = Inputs.range([0, 360], {label: "Rotate", step: 10})
Insert cell
Insert cell
{
const canvasWidth = 720
const canvasHeight = 480
const center = [0.5 * canvasWidth, 0.5 * canvasHeight]
const canvas = DOM.canvas(canvasWidth, canvasHeight)
const p = new paper.PaperScope();
p.setup(canvas)

const background = new p.Path.Rectangle({
point: [0, 0],
size: [canvasWidth, canvasHeight],
fillColor: "#2b8941"
});

const polygon = new p.Path.RegularPolygon({
center: [360, 240],
sides: sides,
radius: radius,
fillColor: '#9254de',
strokeColor: 'blcak'
})

polygon.onFrame = function (event) {
this.rotate(rotate);
this.fillColor.hue -= 1
};

return canvas
}
Insert cell
Insert cell
paper = require("paper")
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