# How do I reverse the animation of a drawing in P5JS (more details in post)

**URL:** <https://discourse.processing.org/t/how-do-i-reverse-the-animation-of-a-drawing-in-p5js-more-details-in-post/33245>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [November 2, 2021, 4:55am UTC](https://discourse.processing.org/t/how-do-i-reverse-the-animation-of-a-drawing-in-p5js-more-details-in-post/33245 "2021-11-02T04:55:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrloosid](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@mrloosid](https://discourse.processing.org/u/mrloosid)\
**Post date:** [November 2, 2021, 4:55am UTC](https://discourse.processing.org/t/how-do-i-reverse-the-animation-of-a-drawing-in-p5js-more-details-in-post/33245/1 "2021-11-02T04:55:20Z")

</div>

Source Code: [p5.js Web Editor](https://editor.p5js.org/theruantan/sketches/aFXKo_s86)

Basically I’m trying to do a pseudo generative poster that swaps between 3 artworks that I have predesigned. The idea is to make load one artpiece, wait a few seconds then reverse (essentially wipe it away) the drawing to a blank canvas then load the next and repeat endlessly.

I’m just trying to recreate the reversal animation that I saw here: [https://www.reddit.com/r/generative/comments/q6krwj/lines\_p5js/](https://www.reddit.com/r/generative/comments/q6krwj/lines_p5js/)

![ezgif.com-gif-maker (1)](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7091dfc26a74235fa86c618fad8335065fb0805e.gif)

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [November 2, 2021, 9:24am UTC](https://discourse.processing.org/t/how-do-i-reverse-the-animation-of-a-drawing-in-p5js-more-details-in-post/33245/2 "2021-11-02T09:24:31Z")

</div>

Cross posted from StackOverflow: [javascript - How do I reverse the animation of a drawing in P5JS (more details in post) - Stack Overflow](https://stackoverflow.com/questions/69793063/how-do-i-reverse-the-animation-of-a-drawing-in-p5js-more-details-in-post)
