You can use compositing to have your sea water seamlessly intrude on your mountain
In particular "source-out" compositing allows you to draw new content only where it doesn't overlap any existing content.
Therefore "source-out" compositing will allow you to draw new sea-water only where it doesn't overlap the existing mountain.
When the water is rising:
- clear canvas
- set globalCompositeOperation="source-over" // the default, new drawings will overdraw
- draw your mountain
- set globalCompositeOperation="source-out" // new sea water will not overdraw existing mountains
- draw the rising sea water
- increase the height of the sea water
- repeat with #1 until your sea water is at desired height
When the water is falling:
- clear canvas
- set globalCompositeOperation="source-over" // the default, new drawings will overdraw
- draw your mountain
- set globalCompositeOperation="source-out" // new sea water will not overdraw existing mountains
- draw the retained sea water only in the pit of your mountain
- draw the falling sea water
- decrease the height of the sea water
- repeat with #1 until your sea water is at desired height