Skip to content
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

Add custom_shapes.js, which will eventually replace vertex.js #7368

Merged
merged 2 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import './core/friendly_errors/sketch_reader';
import shape from './shape';
shape(p5);

// shapes
import customShapes from './shape';
customShapes(p5);

//accessibility
import accessibility from './accessibility';
accessibility(p5);
Expand Down
32 changes: 32 additions & 0 deletions src/shape/custom_shapes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @module Shape
* @submodule Custom Shapes
* @for p5
* @requires core
* @requires constants
*/

// declare MyClass

function customShapes(p5, fn) {

// ---- FUNCTIONS ----

// documentation here

// fn.myFunction = function() {
// this.background('yellow'); // call an existing p5 function
// };

// ---- CLASSES ----

// documentation here

// p5.MyClass = MyClass;
}

export default customShapes;

if (typeof p5 !== 'undefined') {
customShapes(p5, p5.prototype);
}
4 changes: 3 additions & 1 deletion src/shape/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import primitives from './2d_primitives.js';
import attributes from './attributes.js';
import curves from './curves.js';
import vertex from './vertex.js';
import customShapes from './custom_shapes.js';

export default function(p5){
p5.registerAddon(primitives);
p5.registerAddon(attributes);
p5.registerAddon(curves);
p5.registerAddon(vertex);
}
p5.registerAddon(customShapes);
}
Loading