Skip to content

Commit 5b12d51

Browse files
authored
commit message (#7368)
1 parent b66247f commit 5b12d51

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

src/app.js

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import './core/friendly_errors/sketch_reader';
88
import shape from './shape';
99
shape(p5);
1010

11+
// shapes
12+
import customShapes from './shape';
13+
customShapes(p5);
14+
1115
//accessibility
1216
import accessibility from './accessibility';
1317
accessibility(p5);

src/shape/custom_shapes.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* @module Shape
3+
* @submodule Custom Shapes
4+
* @for p5
5+
* @requires core
6+
* @requires constants
7+
*/
8+
9+
// declare MyClass
10+
11+
function customShapes(p5, fn) {
12+
13+
// ---- FUNCTIONS ----
14+
15+
// documentation here
16+
17+
// fn.myFunction = function() {
18+
// this.background('yellow'); // call an existing p5 function
19+
// };
20+
21+
// ---- CLASSES ----
22+
23+
// documentation here
24+
25+
// p5.MyClass = MyClass;
26+
}
27+
28+
export default customShapes;
29+
30+
if (typeof p5 !== 'undefined') {
31+
customShapes(p5, p5.prototype);
32+
}

src/shape/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import primitives from './2d_primitives.js';
22
import attributes from './attributes.js';
33
import curves from './curves.js';
44
import vertex from './vertex.js';
5+
import customShapes from './custom_shapes.js';
56

67
export default function(p5){
78
p5.registerAddon(primitives);
89
p5.registerAddon(attributes);
910
p5.registerAddon(curves);
1011
p5.registerAddon(vertex);
11-
}
12+
p5.registerAddon(customShapes);
13+
}

0 commit comments

Comments
 (0)