# Struggling to implement a pause/delay within my for-loop

**URL:** <https://discourse.processing.org/t/struggling-to-implement-a-pause-delay-within-my-for-loop/26313>\
**Category:** Coding Questions\
**Created:** [December 16, 2020, 8:45pm UTC](https://discourse.processing.org/t/struggling-to-implement-a-pause-delay-within-my-for-loop/26313 "2020-12-16T20:45:45Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [December 17, 2020, 11:34am UTC](https://discourse.processing.org/t/struggling-to-implement-a-pause-delay-within-my-for-loop/26313/12 "2020-12-17T11:34:19Z")

</div>

in theory, you can let your sketch run in a secondary thread. The thread would update an image with the output.

The primary Sketch would then display this image. With this (and some timers) you can achieve an animation with for-loops too. But I think the way above (using that draw() is looping) is much easier.

Chrisir

cf. [Update screen during draw() without thread?](https://discourse.processing.org/t/update-screen-during-draw-without-thread/18599) (for recursion though)

---

_[View the full topic](https://discourse.processing.org/t/struggling-to-implement-a-pause-delay-within-my-for-loop/26313)._
