How to make cup fill animation without drawing all frames? (Solved)

Hi, is it possible to make drink animation without drawing all frames like this (cup will be shaped like this and drink level should be adjustible)

  1. Draw two sprites. one with the empty cup, one with the full inside of the cup.
  2. Create a separate all white or all red sprite that is larger than the cup (or stretch it larger than the cup)
  3. Install the “Masking” extension.
  4. Add all of the sprites to the scene.
  5. Set up the masking event to mask “full cup” with the white/red sprite.
  6. Move the white/red sprite up or down. If it overlaps with the “Full cup” sprite, that part of “Full cup” will be displayed, while the rest of it will be invisible. So the less there’s overlap, the less the cup will be visible.

Here’s another way using the shape painter and a slider for testing. The shape painter’s clear between frames is unchecked and the slider goes from 0 to 50.

Try it:

50 is the height and width of the cup and 10 is the difference per side in the width comparing the top of the cup to the bottom of the cup. 40 is the bottom-right point (50-10). First block does water, 2nd does outline.