Created
July 24, 2013 05:39
-
-
Save daseyb/6068285 to your computer and use it in GitHub Desktop.
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
//_pos is in pixel coordinates in a quad | |
float2 offsetFunc(float2 _pos) | |
{ | |
//distance from the center (the quad is (radius + width) * 2 pixels wide) | |
_pos -= radius + width; | |
_pos /= scale; | |
float x = length(_pos); | |
//function, made in GeoGebra: http://imgur.com/zMbqAcs | |
float val = cos((x - currentRadius)/(width/PI)) * strength/2 + strength/2; | |
if(abs(x - currentRadius) > width) | |
val = 0; | |
return normalize(_pos) * val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment