Created
January 23, 2013 11:04
-
-
Save boredzo/4604459 to your computer and use it in GitHub Desktop.
Two-color angle gradient in Core Image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kernel vec4 coreImageKernel(__color startColor, __color endColor) | |
{ | |
vec2 point = destCoord(); | |
float angle = atan(point.y, point.x) + radians(180.0); | |
//Start from the upper middle, not the left middle | |
angle += radians(90.0); | |
angle = mod(angle, radians(360.0)); | |
float fraction = angle / radians(360.0); | |
vec4 resultColor = startColor * (1.0 - fraction) + endColor * fraction; | |
return resultColor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment