I would really like to achieve a see-through text style effect in my iOS app. It’s pretty simple to create the desired effect in Photoshop, but I have no idea how this could be accomplished in code.
The effect applied to text simply shows the background underneath the text, but it is darkened (or lightened) so that it is visible. There is no fill for the text at all, it just enhances the background where the text would be.
This is what I want to obtain:
This effect is kind of similar to the “slide to unlock” text on iOS 7.1+ (before the sliding animation occurs), but I’d like more of the image to show through.
How could one create such an effect? I only have to support iOS 8+.
This is how the effect can be created in Photoshop (there’s probably an even easier way):
- Open an image
- Duplicate the image onto another layer
- Change the blend mode (to Overlay to be darker, or Screen to be lighter)
- Add a layer mask
- Option/alt click the layer mask and change the fill to black
- Add white text where desired
- Alt click the layer mask
It’s not as simple as just creating a black or white label and decreasing the opacity. That’s what it looks like when you do that:
3
Answers
You do it exactly the same as photoshop, but with less steps:
Put both layers inside a UIView.
There’s no need to limit yourself to iOS 8. All of this works going back to iOS 1.0.
Have a look into the GPUImage Library, is pretty awesome and has some really neat image filters like overlay, blend, multiply and so on.
https://github.com/BradLarson/GPUImage
In iOS i wrote code in swift language. I created a layer. Setup layer property as layer.opacity = 0.5. You can change this property as transparent you want. Add text, drawings etc to this layer. Layer has see thru effect