Published
Edited
Sep 28, 2021
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
canvas = {
const canvas = DOM.canvas(width, height);
const p = new paper.PaperScope();
const { Path, Point, Color, Layer, project } = p;
paper.setup(canvas);

let fillColor = "hsl(216deg 100% 13%)";

let bg = new Path.Rectangle({
point: [0,0],
size: [width, height],
fillColor
});

const layer01 = new Layer();

const centerPt = new Point(width / 2, height / 2);

var rect = new Path.Rectangle({
point: [0,0],
size: [rectWidth, rectWidth],
fillColor,
strokeColor: "white",
});

const angle = 360 / count;

for (let i = 0; i < count; i++) {
const clonedPath = rect.clone();
const scale = i * scaleFactor;
clonedPath.scale(scale);
clonedPath.rotate(angle * i * rotationFactor);
}
const layer02 = new Layer();
layer02.name = "%noprint"; // axidraw does not print layer with `%` in front

var boundingRect = new Path.Rectangle({
point: layer01.bounds.topLeft,
size: layer01.bounds,
strokeColor: "magenta"
})
mutable layer01Pos = layer01.bounds.width

layer01.translate(new Point(centerPt.x, centerPt.y));
layer02.translate(new Point(centerPt.x, centerPt.y));
return canvas;
}
Insert cell
mutable layer01Pos = 0
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
paper.projects
Insert cell
width = canvasSize[0]
Insert cell
height = canvasSize[1]
Insert cell
Insert cell
Insert cell
paperSizes[paperSizeSelect]
Insert cell
Insert cell
paper = require('paper');
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more