Skip to content

An npm / npx starter template for P5 projects using Typescript and Hot Reload preview

Notifications You must be signed in to change notification settings

simplyhexagonal/create-p5-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Create P5 Project

Introduction

An npm / npx starter template for P5 projects using Typescript and Hot Reload preview. This tool simplifies the process of setting up a p5.js project, allowing you to focus on creating fully parametric 2D drawings, 2D animations, and fully interactive vector-based experiences in the browser with ease.

Demo GIF

Features

  • 🚀 Easy Setup: Initialize your P5 project with a single command.
  • 💻 TypeScript Support: Leverage the power of TypeScript for more robust code.
  • 🔁 Hot Reload Preview: Instantly view changes in your design as you code.
  • 📁 Automated Structure and Dependency Management: Automatically creates the necessary folder structure and installs dependencies.
  • 🎨 Focus on Design: Spend more time designing and less on setup.
  • 🛠️ Integrated VSCode Experience: Recommended extensions and launch configurations for a seamless development experience.
  • 📤 SVG Export Option: Export your designs SVG format.

Like this project? ❤

Please consider:

Getting Started

Prerequisites

Ensure you have Node.js installed on your system to use npm or npx.

Installation

To create a new P5 project, run the following command in your terminal:

npm init p5-project <your-project-name>

or

npx create-p5-project <your-project-name>

This command will create a new directory with your project name, set up the folder structure, and install all the necessary dependencies.

Templates

To use a specific template, pass the --template argument when creating a new project. For example:

npm init p5-project <your-project-name> -- --template=screw-and-nut

To list available templates you can run:

npx create-p5-project --list-templates

There are currently three templates available:

  • default: A blank canvas for whatever project you're working on.
  • svg-export: Contains a screw and nut for you to play with.
  • sound: Contains a screw and nut for you to play with.

More templates will be added soon, hopefully by contributors too!

VSCode Integration

  • Recommended Extensions: The generated .vscode directory contains recommendations for helpful extensions. Please review and install them to enhance your development experience.
  • Launch Configuration: Use the "Launch P5" configuration in the Run and Debug section of VSCode. This will open the design.ts file, run npm run dev, and open the preview browser.
    • Note: The first time you run this, the preview browser may initially display a white screen. Please wait until the debug output indicates that it's safe to reload the simple browser panel.

Alternatively - Development in other IDEs

If you are NOT using VSCode, or if you'd rather run the dev environment manually, then, after setting up your project, navigate to your project directory and start the development server:

cd <your-project-name>
npm run dev

Preview and Export

  • The project uses Vite to provide a hot reload dev server to be able to preview changes to the design any time you save.
  • To export to SVG, you can set the renderSvg variable to true and serialize the SVG html element for download. For an example you can use the svg-export template.

Related Projects and Resources

create-p5-project is built upon and inspired by the capabilities of p5.js. Here are some resources and related projects that can enhance your experience with p5.js:

  • p5.js: The core framework upon which this project is based. For more information and documentation, visit P5's website.

  • p5.js Cheat Sheet: A handy guide for quick reference to P5 syntax and features. Perfect for beginners and experienced users alike. Check out the P5 Cheat Sheet by Andreas Metz.

  • Using p5.js & React to fill a Canvas: Dive into a practical example of integrating p5.js with React for creative coding in this informative talk by Monica Powell. Watch the Using p5.js & React to fill a Canvas video for insights and inspiration.

  • Processing: The Processing software is used by thousands of visual designers, artists, and architects to create their works. It is the parent project of p5.js. For more information and documentation, visit the Processing website.

Contributing

Contributions are welcome! Feel free to submit pull requests or open issues to improve create-p5-project.

Contributors

jeanlescure

License

This project is licensed under the Apache-2.0.

Happy Designing with create-p5-project!

About

An npm / npx starter template for P5 projects using Typescript and Hot Reload preview

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published