Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw UIBezierPath That Fades at Ends (Gradient)

I am trying to draw a UIBezierPath that fades out at both ends - from alpha 0 to 1 then back to 0. I basically want to be able to draw a gradient in a UIBezierPath from within drawRect.

EDIT: Here's the effect I'm trying to achieve:

enter image description here

like image 439
Undo Avatar asked Feb 02 '13 22:02

Undo


1 Answers

What about using -strokeWithBlendMode:alpha:?

In combination with some sort of loop that keeps incrementing/decrementing the alpha value until you reach the 1 (and the increment determines the length of the "faded" segment) should work.

See here

like image 75
Fabiano Francesconi Avatar answered Oct 07 '22 01:10

Fabiano Francesconi