CLI tool to rapidly create setches with p5.js and Typescript

Overview

P5 Studio

Screenshot

Table of matters

Getting started

Installation

P5 Studio is available as a CLI, it is recommended to install it globally.

npm i -g p5-studio

Creating a new workspace

You can easily create a new workspace using the CLI.

p5 create MyNewWorkspace

Starting the web interface

Once you have successfully created a new project you can now use the serve command to start the development server.

This can be done by running the serve script that has been automatically added to the package.json file.

# with yarn
yarn serve

# with npm
npm run serve

By default the server will start on port 3000 and can be accessed by opening http://localhost:3000 in the browser

CLI

Usage: p5 [options] [command]

Commands

new [options] <name>

Creates a new workspace with the provided name

Option Description Default
-o, --out Path of the output directory Current working directory

generate [options] <name> / g [options] <name>

Generate a new sketch with the provided name

Option Description Default
-o, --out Path of the output directory Current working directory

serve [options]

Option Description Default
-p, --port Port to start the server on 3000
-d, --sketchesDir Directory that contains the sketches Current working directory

Writing sketches

Sketches must be written in Typescript, they are compiled to Javascript automatically using esbuild.

All sketches within the specified sketch directory will be available through the web interface.

In order for a sketch to be recognized, the file name must end by .sketch.ts.

It is recommended to use the generate command to create new sketches in order to avoid mistakes.

Example sketch

import { SketchFn, SketchMetadata } from "p5-studio";

// This is your sketch metadata, everything is optionnal
// name: The name of your sketch
// resolution: The width and height of your sketch
// fps: The number of time your sketch is rendered every second (rendered only once if not specified)
export const metadata: SketchMetadata = {
  name: "Example sketch",
  resolution: {
    w: 500,
    h: 500,
  },
};

// This function is called once every time the sketch is loaded.
// You can initialize variable and settings here.
// The parameter p is the p5 instance.
export const setup: SketchFn = (p) => {
};

// This function is called once every frame.
// Do your drawing here
// The parameter p is the p5 instance.
export const draw: SketchFn = (p) => {
  p.noFill();
  p.strokeWeight(5);
  p.stroke("red");
  p.circle(250, 250, 300);
};
You might also like...

GitSol - an onchain version control protocol, service and cli tool

GitSol - an onchain version control protocol, service and cli tool

GitSol an onchain version control protocol, service and cli tool. Content what and why 📓 Features ✨ Install 🐙 Usage 💡 Examples 🖍 Documentation 📄

Sep 10, 2022

CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files.

convert-to-oklch CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files. npx convert-to-oklch ./src/**/*

Dec 20, 2022

A CLI tool to generate barrels with ease, efficiency, and intelligence

A CLI tool to generate barrels with ease, efficiency, and intelligence

JS-Barrels A CLI tool to generate barrels with ease, efficiency, and intelligence Usage npx js-barrels -d ./folder/to/generate/barrels/for Options -d,

Aug 17, 2022

AI-based CLI tool for code generation and mass refactoring

AI-based CLI tool for code generation and mass refactoring

fixgpt Tool that helps you do mass changes across your codebase Create new files Mass refactoring Remove files upon certain conditions Code execution

May 5, 2023

Strcmp-node - A cli string comparison tool, because apparently one doesn't exist.

Strcmp-node - A cli string comparison tool, because apparently one doesn't exist.

strcmp-node I couldn't find a string comparison command, so i made my own. its probably the ugliest thing since godzilla with makeup on, but it works.

Jan 1, 2022

🦄 A CLI tool to quickly generate Next.js components

🦄 A CLI tool to quickly generate Next.js components

🦄 nextrate A CLI tool for quickly generating Next.js components. ✨ Features Automatically add the file type to the component name using the folder na

Aug 19, 2022

A CLI tool to embed interactive PUML diagrams to your github markdown files.

puml-for-markdown Simple CLI Usage Just run puml-for-markdown in any directory where you have markdown files and it will render links to PlantUML file

Jan 3, 2023

A CLI tool to make Taobao's npm mirror sync your package immediately.

npm-mirror-sync A CLI tool to make Taobao's npm mirror sync your package immediately. 让淘宝的 NPM 镜像立即收录你的包的新版本。 背景 相信国内小伙伴都在用淘宝的 NPM 镜像(npmmirror.com)作为

Jun 9, 2022

This CLI tool allows you to convert the encrypted Akamai 2.0 sensor data payload back to its plaintext form.

Akamai 2.0 Sensor Data Decryption Tool This CLI tool allows you to convert the encrypted Akamai 2.0 sensor data payload back to its plaintext form. Us

Jan 1, 2023
Owner
Antoine
dev.
Antoine
Service Installer for VMware Tanzu is a one-click automation solution that enables VMware field engineers to easily and rapidly install, configure, and operate VMware Tanzu services across a variety of cloud infrastructures.

Service Installer for VMware Tanzu Service Installer for VMware Tanzu seeks to provide a one-click automation solution to enable our VMware engineers

VMware Tanzu 42 Dec 1, 2022
A simple library for Node and the browser that allows you to rapidly develop stateful, socketed multiplayer games and web applications.

gameroom.js Overview gameroom.js is a simple library for Node and the browser that allows you to rapidly develop stateful, socketed multiplayer games

Jackson Bierfeldt 3 Nov 3, 2022
A toolkit to rapidly scaffold out a new tauri-apps project using the framework of their choice.

create-tauri-app Component Version create-tauri-app About Tauri Tauri is a polyglot and generic system that is very composable and allows engineers to

Tauri 408 Jan 4, 2023
A powerful, extensible, customizable & rapidly develop hacking framework.

YourN3xt(Beta) A powerful, extensible, customizable & rapidly develop hacking framework. Installations Github: https://github.com/OTAKKATO/YourN3xt N

OTAK 4 Nov 21, 2022
Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

Cory Rylan 7 May 17, 2022
CLI tool to add @ts-expect-errors to typescript type errors

suppress-ts-errors Cli tool to add comments to suppress typescript type errors. Add @ts-expect-error or @ts-ignore comments to all locations where err

ryo 53 Dec 8, 2022
TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers, v2022.10.23 is ready on NPM

TSCI CLI TypeScript CLI for creating HTML & CSS & TypeScript project with different bundlers. Installation npm i -g tsci Usage Want to contribute? You

Samet ÇELİKBIÇAK 7 Dec 14, 2022
Serverless boilerplate CLI tool: GitLab and GitHub CI/CD, DataDog, Multi-Region, and many more setups.

Serverless Full Boilerplate This is a CLI tool to create Serverless boilerplate applications. Ready to deploy in a few seconds. Usage npm i -g create-

Emin Buğra Saral 9 Nov 7, 2022
API and CLI tool to fetch and query Chome DevTools heap snapshots.

Puppeteer Heap Snapshot Capture heap snapshots and query the snapshot for objects matching a set of properties. Read more about it in this blog post.

Adrian Cooney 858 Jan 3, 2023
Framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. 🗺️ Remix driver included. 🤟

About routes-gen is a framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. Think of it as Prisma,

Stratulat Alexandru 192 Jan 2, 2023