Giter VIP home page Giter VIP logo

p5-vite-kit's Introduction

p5-vite-kit

multi page mode and framework starter kit tool base on vite.

Quick Start

$ npx degit zhaohuanyuu/p5-vite-kit#main my-p5-app

$ cd my-p5-app

$ npm install
$ npm start

usage

Add custom pages in the pages directory to dynamically generate multiple entries.

The multi-page configuration refers to vite-plugin-mpa

src/pages
  |- start
    |- index.html
    |- main.js
  |- so on...

The writing of p5 in esmodule refers to p5-wrapper the p5-wrapper is located at src/common/p5Wrapper

import { sketch } from "@addons/p5Wrapper";

sketch.setup = function () {
	createCanvas(800, 600);
};

sketch.draw = function () {
	background(100);
	fill(255, 0, 0);
	noStroke();
	rectMode(CENTER);
	rect(mouseX, mouseY, 50, 50);
};

sketch.mousePressed = function () {
	console.log('here');
};

It is then accessible in the local server. Example: localhost:3000 will show the multiple page list named as their folder name, click href to or manually typed in browser.

p5-vite-kit

Bundle

After bundling, the pages in the corresponding pages directory will be promoted to the dist first-level directory, and you can use the preview command to preview it.

$ npm run build
$ npm run preview
dist
 |- assets
   |- corresponding js
   |- corresponding image...
   |- etc
 |- start
   |- index.html

License

This project is open source and available under the MIT License.

p5-vite-kit's People

Contributors

zhaohuanyuu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.