Skip to content

Commit 41a82f6

Browse files
authored
Merge pull request #896 from reshma045/issue868-branch
Rename conflicting sphere() functions to avoid shadowing p5.js built-in
2 parents a142774 + 7ebcace commit 41a82f6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/content/tutorials/en/intro-to-p5-strands.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function instancingCallback() {
210210
return fract(sin(dot(seed, [12.9898, 78.233])) * 43758.5453123);
211211
}
212212
213-
function sphere() {
213+
function randomPositionOnSphere() {
214214
let id = instanceID();
215215
let theta = rand([id, 0.1234]) * TWO_PI;
216216
let phi = rand([id, 3.321]) * PI;
@@ -223,7 +223,7 @@ function sphere() {
223223
}
224224
225225
getWorldInputs((inputs) => {
226-
inputs.position += sphere();
226+
inputs.position += randomPositionOnSphere();
227227
return inputs;
228228
});
229229
}
@@ -282,7 +282,7 @@ function instancingCallback() {
282282
return fract(sin(dot(seed, [12.9898, 78.233])) * 43758.5453123);
283283
}
284284
285-
function sphere() {
285+
function getAnimatedSpherePosition() {
286286
let id = instanceID();
287287
let theta = rand([id, 0.1234]) * TWO_PI;
288288
// change the particle's position over time:
@@ -298,7 +298,7 @@ function sphere() {
298298
}
299299
300300
getWorldInputs((inputs) => {
301-
inputs.position += sphere();
301+
inputs.position += getAnimatedSpherePosition();
302302
return inputs;
303303
});
304304
}

0 commit comments

Comments
 (0)