diff --git a/src/app.js b/src/app.js index 85c99e2e11..ad4b74c83c 100644 --- a/src/app.js +++ b/src/app.js @@ -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); diff --git a/src/shape/custom_shapes.js b/src/shape/custom_shapes.js new file mode 100644 index 0000000000..fac21ddd9d --- /dev/null +++ b/src/shape/custom_shapes.js @@ -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); +} \ No newline at end of file diff --git a/src/shape/index.js b/src/shape/index.js index 7df6b30698..dbc520ff83 100644 --- a/src/shape/index.js +++ b/src/shape/index.js @@ -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); +} \ No newline at end of file