Use multiple orbit traps

fractal {
	// Set region margins to left=-3.0, bottom=-1.5, right=0.0, top=1.5
	// Declare state vector as [x,n] where x and n are built-in variables
	orbit [<-3.0,-1.5>,<0.0,1.5>] [x,n] {
		// Declare circular orbit trap with center in (0,0) and name circle0
		trap circle0 [<0,0>] {
			MOVETO(<1,0>);
			ARCTO(<1,1>,<0,1>);
			ARCTO(<-1,1>,<-1,0>);
			ARCTO(<-1,-1>,<0,-1>);
			ARCTO(<1,-1>,<1,0>);
		}
		// Declare circular orbit trap with center in (0,0) and name circle1
		trap circle1 [<0,0>] {
			MOVETO(<1.1,0>);
			ARCTO(<1.1,1.1>,<0,1.1>);
			ARCTO(<-1.1,1.1>,<-1.1,0>);
			ARCTO(<-1.1,-1.1>,<0,-1.1>);
			ARCTO(<1.1,-1.1>,<1.1,0>);
		}
		// Iterate for n from 0 to 200 stopping when mod2(x) > 4 or x falls outside trap circle0 but inside trap circle1
		loop [0, 200] (mod2(x) > 4 | (circle0 ~? x & circle1 ? x)) {
			// Declare orbit equation where x is a state variable and w is current point of region
			x = x * x + w;
		}
	}
	// Set background color to alpha=1, red=0, green=0, blue=0
	color [(1,0,0,0)] {
		// Create palette with 200 colors and name gradient
		palette gradient {
			[#FFFF0000 > #FFFFFFFF, 10];
			[#FFFFFFFF > #FFFF0000, 190];
		}
		// Apply rule when n > 0 and set opacity to 1.0
		rule (n > 0) [1] {
			// Set color to element n - 1 of gradient (gradient has 200 colors starting from index 0)
			gradient[n - 1]
		}
	}
}

Use multiple orbit traps


Follow NextFractal on Facebook