/*
 * Author: Bernie Innocenti <bernie@codewiz.org>
 *
 * 1999-03-26  Original Amiga Version
 * 2002-04-30  Enhanced Linux Version
 */

#include "colors.inc"

#declare LOOPS = 1.6;

background { color Black }

#declare CAMERA_LOC = <sin(clock*2*LOOPS*pi)*(2.0-4*(clock-0.5)*(clock-0.5)), cos(clock*2*LOOPS*pi)*(2.6-4*(clock-0.5)*(clock-0.5)), 0.7>;
#declare CAMERA_ROT = <clock*360, clock*360, 0>;
camera
{
	location CAMERA_LOC
	//location <2.4, 3, 0.7>
	look_at <0, 0, 0>
	normal { bumps ((clock < 0.5) ? 0 : ((clock - 0.5) * 2)) }

	// for depth of field
	aperture 0.02
	blur_samples 100
}

light_source
{
	<2, -3, -1>
	color Gray70
	shadowless
}

light_source
{
	<-2, 3, 2> //-3*(clock-0.5)>
	color White
}



object {
	julia_fractal {
		<-0.083,0.0,-0.83,-0.025>
		slice <0,0,0,1>,(clock-0.5)*1.95
		quaternion
		sqr
		max_iteration 15
		precision 20
	}
	scale <1,1,1>
	finish { ambient 0.15 }
	pigment {
		//color Yellow
		//color <0.2,0.7,0.7,((clock < 0.5) ? 0.0 : (clock - 0.5) * 1.8), 0>
		#declare JULIA_TRANSPARENCY = ((clock < 0.3) ? 0.0 : (clock - 0.3) * 1.8);
		//gradient y
		spherical
		color_map {
			[0.0  color <0.4,1.0,0.4,JULIA_TRANSPARENCY*1.0> ]
			[0.2  color <0.4,1.0,1.0,JULIA_TRANSPARENCY*0.8> ]
			[0.35 color <0.4,0.4,1.0,JULIA_TRANSPARENCY*0.6> ]
			[0.5  color <1.0,0.4,1.0,JULIA_TRANSPARENCY*0.4> ]
			[0.7  color <1.0,0.4,0.4,JULIA_TRANSPARENCY*0.2> ]
			[1.0  color <1.0,1.0,0.4,JULIA_TRANSPARENCY*0.0> ]
		}
		scale 1.5
	
		//leopard
		//crackle form <-1,1,0>
		//checker colour <1,0,1> colour Yellow
	}
//	translate <0,0,0>
}

/*plane { y, 0
	pigment {
		checker colour Red colour White
		scale 2
	}
	finish {
		ambient 0.2
		diffuse 0.8
	}
	translate <0,0,0>
}*/

/*
text {
	ttf "timrom.ttf" "POV-Ray" 0.1, 0
	pigment { Red }
	scale 0.2
	rotate    CAMERA_ROT
	translate CAMERA_LOC * 0.8 /*- <0.2,0.2,0.0>*/
}*/

#declare GLOW1 = sin((clock+0.2)*07*LOOPS*2*pi)/10;
#declare GLOW2 = sin((clock+0.6)*12*LOOPS*2*pi)/10;
#declare GLOW3 = sin((clock+0.9)*03*LOOPS*2*pi)/10;

box {
	<-3, -3, -3>,	// Near lower left corner
	<3, 3, 3>	// Far upper right corner
	normal { bumps 0.5 }
	pigment {
		//checker colour Red colour White
		//brick colour Red colour White
		//hexagon color Red color Green color Blue
		//hexagon color Gray30 color Gray60 color Gray80
		hexagon color <0.6+GLOW1,0.6,0.6> color <0.6,0.6+GLOW2,0.6> color <0.6,0.6,0.6+GLOW3>
		scale 0.65
		rotate <0.3,0.2,0.7>
	}
	finish {
		ambient 0.1
		diffuse 0.8
	}
	hollow
	no_shadow
}

