Skip to content

P5.js boilerplate addition #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/boilerplates/p5/codepan.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script type="text/javascript" src="https://p5js.org/assets/js/p5.min.js"></script>
11 changes: 11 additions & 0 deletions src/boilerplates/p5/codepan.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const cl = console.log;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this isn't necessary

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true that.

const W = H = 400;
function setup() {
createCanvas(W, H);
background(0);
}
function draw() {
const middle = W/2;
const diameter = 10;
circle(middle,middle,diameter);
}
18 changes: 18 additions & 0 deletions src/boilerplates/p5/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default async () => {
const [htmlCode, jsCode] = await Promise.all([
import('!raw-loader!./codepan.html'),
import('!raw-loader!./codepan.js')
])

return {
html: {
code: htmlCode,
transformer: 'html'
},
js: {
code: jsCode,
transformer: 'babel'
},
showPans: ['js', 'output']
}
}
1 change: 1 addition & 0 deletions src/components/HomeHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<el-dropdown-item command="es-import">ES import</el-dropdown-item>
<el-dropdown-item command="rust">Rust</el-dropdown-item>
<el-dropdown-item command="pixi">Pixi</el-dropdown-item>
<el-dropdown-item command="p5">P5.js</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button
Expand Down