코딩하는 둥둥

mask-image 본문

Frontend/CSS

mask-image

둥둥 2023. 1. 15. 19:55
728x90

mask-image

  • 이미지를 마스킹(마스크 적용)

이미지 마스킹(마스크)

  • 🔗https://en.wikipedia.org/wiki/Masking_(art)
  • 필요한 부분만을 칠하기 위해 불필요한 부분을 원하는 형태로 가리는것
    • 이미지의 특정 영역에만 효과가 적용되도록 효과가 적용되지 않을 부분과 구분해 주는 것
  • 얼굴을 숨긴다는 의미의 마스크에서 파생
  • 포토샵의 클리핑 마스크와 같은 효과
 

Masking (art) - Wikipedia

From Wikipedia, the free encyclopedia Masking tape being peeled off of a canvas, to reveal the protected, unpainted area below In art, craft, and engineering, masking is the use of materials to protect areas from change, or to focus change on other areas.

en.wikipedia.org

CODE


        /* Keyword value */
        mask-image: none;

        /*  value */
        mask-image: url(masks.svg#mask1);

        /*  values */
        mask-image: linear-gradient(rgba(0, 0, 0, 1), transparent);
        mask-image: image(url(mask.png), skyblue);

        /* Multiple values */
        mask-image: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1), transparent);

        /* Global values */
        mask-image: inherit;
        mask-image: initial;
        mask-image: revert;
        mask-image: revert-layer;
        mask-image: unset;
    

사용시 주의 할 점

  • 크롬, 사파리에서는 -webkit접두어가 붙어야만 동작한다.
    • 붙이지 않아도 자동으로 붙여준다.
      enter image description here

References.

https://developer.mozilla.org/en-US/docs/Web/CSS/mask-image

 

mask-image - CSS: Cascading Style Sheets | MDN

The mask-image CSS property sets the image that is used as mask layer for an element. By default this means the alpha channel of the mask image will be multiplied with the alpha channel of the element. This can be controlled with the mask-mode property.

developer.mozilla.org

http://yoonbumtae.com/?p=4279

 

CSS 이미지에 마스킹 하기 (mask image) + 앱스토어 아이콘처럼 보이게 곡률 조정 (코너 깎기) - BGSMM

CSS MASK-IMAGE 아래와 같은 이미지를 마스킹(마스크 적용)하는 방법입니다. 참고: 이미지 마스킹(마스크)이란?   마스킹으로 덧씌울 PNG 이미지 파일을 준비합니다. 이 마스킹 이미지를 씌우면 투명

yoonbumtae.com

 

728x90

'Frontend > CSS' 카테고리의 다른 글

Grid Layout  (0) 2023.01.15
scrollY vs pageYOffset  (0) 2022.11.19
overflow  (0) 2022.11.19
line-height  (0) 2022.11.19
justify-content  (0) 2022.11.19