User:Hickman/CIS280/Tree4

From MCIS Wiki

Jump to: navigation, search

Tree Project 4

Picture

Image:Pic.PNG

Code

red = (1,0,0);
green = (0,1,0);
blue = (0,0,1);
white = (1,1,1);
interpC(t, (r1, g1, b1), (r2, g2, b2)) = ((1-t) * r1 + t * r2,
                                          (1-t) * g1 + t * g2,
                                          (1-t) * b1 + t * b2);
p1 = color(blue, rect(400, 400, (0,0)));
p2 = color(interpC(0.7, green, red), rect(380, 380, (10, 10)));
p3 = ovals(40);
picture = over(p3, over(p2, p1));
ovals(n) = if n == 360 then oval(0,0,(0,0)) else
     over(color(interpC((n-30)/320, white, blue),
               oval(n+1,n+1,(0,0))),
          ovals(n+20));

for(init, final, step, fn) = if init > final then oval(0,0,(0,0)) 
  else over(fn(init), for(init + step, final, step, fn));

f(i) = color((),oval(5-i,5 - i,(10*i,10*i)));

picture = for(0,20,1,f);
Personal tools