IconCard 📦

以「SF Symbol 為前景,透明方紙為背景」的元件,適合用於當遮罩或反面遮罩。

如果遮罩圖與要剪的紙一樣大,用 SystemImage 📦 就可以。 如果遮罩圖較小、要剪的紙較大,用 IconCard 📦

下圖顯示 img (IconCard) 從套用 .foregroundColor(.black)、.background(Color.white)、.compositingGroup()、.luminanceToAlpha(),一直到 paper (紅色星點紙) 套用 .mask() 的整個過程。

這個過程後來被濃縮成一個 View extension:.inverseMask() 🌀

左上角是 IconCard 的原圖 (img)

Last updated

Was this helpful?