p8g.js
v0.9.0
Published
Precessing, also known as p8g, is a general-purpose 2D graphics library
Downloads
15
Maintainers
Readme
Precessing
| Beginner friendly | Language-agnostic | Cross-platform | | :--------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------: | | p8g has been developed for individuals interested in getting into creative programming no matter the experience. | p8g is available for C, C++, Java, JavaScript and TypeScript allowing further language bindings to be developed. | p8g applications can be developed on and built for all major operating systems including Windows, Linux and macOS as well as the web. |
Install
npm install p8g.js
npm install vite --save-dev
npm install vite-plugin-top-level-await --save-dev
Hello rectangle!
.
├── hello-rectangle.js
├── index.html
└── vite.config.js
hello-rectangle.js
import p8g, {
background,
createCanvas,
rect,
} from 'p8g.js';
p8g.draw = () => {
background(220);
rect(50, 50, 100, 100);
};
createCanvas(320, 320);
index.html
<!DOCTYPE html>
<html>
<head>
<title>Hello rectangle!</title>
</head>
<body>
<script type="module" src="hello-rectangle.js"></script>
</body>
</html>
vite.config.js
import { defineConfig } from 'vite';
import topLevelAwait from 'vite-plugin-top-level-await';
export default defineConfig({
plugins: [topLevelAwait()],
});
Run
npx vite