A collection of different experiments using P5.JS, ranging from simple examples to audio and gamepad powered visualizations.
- Clone this repo.
- Install dependencies:
yarn - Run the development server:
yarn dev - See the site here 👀: http://localhost:3000/
You can also preview and fork on CodeSandbox
To create a new P5.JS "sketch" or experiment, you can use the following command:
yarn sketch:new YourSketchName
You should see the new component appear in the project under src/experiments/. A new page will be automatically created for it as well, using a snake-case version of the name you picked.
The sketch name will be used for the React component name, so make sure it's CamelCased.
- Place media in
/public/folder. - Use a relative URL to your media (
yoursite.com/video.mp4if it's inpublic/video.mp4).
This project features VSCode snippets for quickly creating R3F components and patterns. You can find them and add more in .vscode\r3f.code-snippets.
r3fc- Create R3F meshr3fg- Create R3F grouptsr3fc- Create R3F mesh (with Typescript)tsr3fg- Create R3F group (with Typescript)
If you use VSCode, Prettier should run each time you save a compatible file.
If you don't like this, go to
.vscode\settings.jsonand disable there (or you can do it via your own VSCode settings).
yarn lint runs ESLint and Prettier, automatically formats files and rewrites them. Make sure to stage your code before running just in case.
yarn upgrade-interactive --latest
Please note that when you update a major version, you should check the dependency's documentation to see if there are any necessary changes to make to app or dependency API.
When you browse the shaders (.frag and .vert) in VSCode, you should see a popup to install a plugin for highlighting.
There's a few, but we recommend Shader languages support for VS Code.