How to write constraint for generating a continuous mask

In reply to dave_59:

Yes, got the point. Thank you!