# Can you help me to understand the code of this sketch?

**URL:** <https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455>\
**Category:** Coding Questions\
**Created:** [May 26, 2025, 11:57am UTC](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455 "2025-05-26T11:57:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amaury](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@amaury](https://discourse.processing.org/u/amaury)\
**Post date:** [May 26, 2025, 11:57am UTC](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455/1 "2025-05-26T11:57:02Z")

</div>

Hi,  
Is there a way to predict where the square and rectangle will appear in the sketch below ? Is it linked to the nature of the “noise” function ?  
[https://openprocessing.org/sketch/2026851](https://openprocessing.org/sketch/2026851)

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![scudly](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/scudly/32/5597_2.png) [@scudly](https://discourse.processing.org/u/scudly)\
**Post date:** [May 26, 2025, 4:34pm UTC](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455/2 "2025-05-26T16:34:30Z")

</div>

The particles have no effect on the image and you can delete all the code associated with them.

This sketch is drawing a bezier curve through a `noise()` field. The `for()` loop is just iterating over 6280 points and computing their position based on `noise()`. If you comment out the `background()` in `draw()` and then `strokeWeight` and `blendMode` in `setup()`, you can see the bezier curve that is being added to the image each frame.

The shape of the rectangles is random within the bounds of the `noise()` function. You could make it predictable by setting `noiseSeed()` to a fixed value.

---

<div class="post-metadata">

**Author:** ![amaury](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@amaury](https://discourse.processing.org/u/amaury)\
**Post date:** [May 26, 2025, 5:27pm UTC](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455/3 "2025-05-26T17:27:24Z")

</div>

Thank you, so I can’t do anything to have a precise “rectangle” shape at that time at that place on the screen ? Do you know if changing noise seeds linearly could make results change linearly ?

---

<div class="post-metadata">

**Author:** ![scudly](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/scudly/32/5597_2.png) [@scudly](https://discourse.processing.org/u/scudly)\
**Post date:** [May 26, 2025, 5:54pm UTC](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455/4 "2025-05-26T17:54:54Z")

</div>

The point of `noise()` is to be random. Changing the noise seeds would cause completely random flickering to the noise output.

There are many different programs you could write to put rectangles at specific locations deliberately, but this code is not trying to do so. `rect()` alone, obviously, would do it. Is there something specific you are trying to do?

---

<div class="post-metadata">

**Author:** ![amaury](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@amaury](https://discourse.processing.org/u/amaury)\
**Post date:** [June 27, 2025, 1:45pm UTC](https://discourse.processing.org/t/can-you-help-me-to-understand-the-code-of-this-sketch/46455/5 "2025-06-27T13:45:34Z")

</div>

Thank your for answering. Sorry to do so that late.
