

| Home | Games | Downloads | Ramblings | About |
| Download: | |
| jME-CircleShader.zip: | Download |
The positions of each color in the circle is set as a percentage, from 0.0-1.0, along the circle's radius so when you change the radius color bands and the center offset are scaled appropriately. The radius and the circle's center are percentages of the quad's width/height so the default center value of X=0.5, Y=0.5 is the center of the quad and the default radius of 0.5 creates a circle with a diameter that spans the full width of the quad.
You can place up to seven colors in a single circle. You must use all the colors between Color and ColorN so if you're using three colors you must use Color, Color2 and Color3, you cannot skip a color such as Color, color2 and Color5. In the latter case you will only see the first and second color.
For this particular ring we only need six of the seven available color slots. Notice we didn't need to set pos6 because this was automatically set to 1.0. We needed Color6 because we don't want the final fade to fade from the edge of the ring all the way to the edge of the circle's radius so instead we create Color5 and position it where we want the final fade to end then create Color6, which is the same color as Color5, so that final transparent color extends out to the circle's radius.
The entire texture is displayed on the quad multiplied by the circle. Note that you can tile the texture so that the quad displays less of the texture or displays the texture multiple times. You can also animate the texture's offset to scroll the texture or use sprite sheets.