IMAGE / 083
Gradient mask
なだらかに隠す
マスクの透明度に応じて、画像の一部を徐々に隠します。
実際のHTML・CSSで描かれた見本です。
実装コードを見る
<style>
.sample{width:100%;height:100%;min-height:190px;display:grid;place-items:center;position:relative;overflow:hidden;box-sizing:border-box;font-family:Arial,'Hiragino Kaku Gothic ProN',Meiryo,sans-serif;color:#20211d;background:#f1f0e9;padding:22px}.sample *{box-sizing:border-box}.sample button,.sample input,.sample summary{font:inherit}.sample button,.sample summary,.sample label{touch-action:manipulation}.sample :focus-visible{outline:3px solid #6050bf;outline-offset:5px}.sample small{font-size:10px;line-height:1.5}.sample .editable{margin:0}.sample svg{max-width:100%;height:auto}
.sample svg{width:220px;mask-image:linear-gradient(to right,#000 30%,transparent);-webkit-mask-image:linear-gradient(to right,#000 30%,transparent)}
</style>
<div class="sample">
<svg viewBox="0 0 240 160" role="img" aria-label="オレンジの太陽と紫の山の図形イラスト"><rect width="240" height="160" fill="#c2dfdb"/><circle cx="168" cy="46" r="29" fill="#ff7540"/><path d="M0 150 85 45 155 145 207 87 240 131V160H0Z" fill="#8c79bd"/><path d="m0 113 49-25 85 72H0Z" fill="#cedb70"/></svg>
</div>