# How to use mask with animation loop?

**URL:** <https://discourse.processing.org/t/how-to-use-mask-with-animation-loop/35244>\
**Category:** Coding Questions\
**Created:** [February 17, 2022, 5:03pm UTC](https://discourse.processing.org/t/how-to-use-mask-with-animation-loop/35244 "2022-02-17T17:03:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ongo](https://avatars.discourse-cdn.com/v4/letter/o/edb3f5/32.png) [@ongo](https://discourse.processing.org/u/ongo)\
**Post date:** [February 17, 2022, 5:03pm UTC](https://discourse.processing.org/t/how-to-use-mask-with-animation-loop/35244/1 "2022-02-17T17:03:59Z")

</div>

Code used to attempt this so far:

> **[p5.js Web Editor](https://editor.p5js.org/ongo/sketches/_oL42sbLI)**
>
> A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners.

I want to find a way to be able to slightly edit a mask on every loop to create an animated effect. Such as on each loop increasing the Y coordinate of where the ellipse is drawn over the mask to make it look like a circle is moving up and down, while maintaining the graphical mask.

So far, the code seems to only draw the mask once. What am I doing wrong?

Any suggestions?
