From 5b12d51ce44bf761df0feb9516a9cc4bd5fca723 Mon Sep 17 00:00:00 2001 From: Greg Stanton <51820777+GregStanton@users.noreply.github.com> Date: Sat, 9 Nov 2024 08:01:00 -0700 Subject: [PATCH] commit message (#7368) --- src/app.js | 4 ++++ src/shape/custom_shapes.js | 32 ++++++++++++++++++++++++++++++++ src/shape/index.js | 4 +++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/shape/custom_shapes.js 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