RST's software laboratory

Navigation: Home / Colorcircle /

ColorCircleApplet

The applet below has no other function than to display a colorful circle. But friends told me, it is cool.




In the color animation above the colors are changed with in frame. The calculation is done with this formulas
  • float red = (float) (Math.sin(radiant + (frame / 180.0 * Math.PI)) + 1) / 2;
  • float green = (float) (Math.sin((frame / 120.0 * Math.PI) - 3 * radiant) + 1) / 2;
  • float blue = (float) (Math.sin((frame / 90.0 * Math.PI) + 2 * radiant) + 1) / 2;
If you're new to java, or you can not resist you can get the source code below as well as the applet binary.
Have Fun!

Content
Colorcircle.jar - Jar archive
ColorCircle.java - Source code