Stacked cubes

If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
romulusnr
Posts: 13
Joined: Wed Jul 06, 2005 2:50 pm
Location: Seattle

Stacked cubes

Post by romulusnr »

I hadn't played with CFDG in a long time, but for some reason recently was inspired to crack it open again and make this:

Code: Select all

startshape CUBESTACK

rule CUBESTACK {
  CUBE { }
  NEXTCUBE { x -.42 y -.24 }
  NEXTCUBE { x .42 y -.24 }
  NEXTCUBE { y .48 }
}

rule NEXTCUBE .33 {
  CUBESTACK {}
}

rule NEXTCUBE .67 {
}

rule CUBE {
      hex { }
      para { size .33 skew 0 30 b .4 x .2 y -.14 }
      para { size .33 skew 0 -30 b .6 x -.2 y -.14 }
      para { r 45 size .4 skew -15 -15 b .8 y .22 }
}

// so that they don't draw before the hex
rule para {
   SQUARE []
}

rule hex {
	SQUARE [rotate 0 size 0.866025 0.5]
	SQUARE [rotate 60 size 0.866025 0.5]
	SQUARE [rotate 120 size 0.866025 0.5]
}

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

We have added a new feature since you last played with Context Free: the z-axis. In addition to moving shapes around in the x and y directions you can now move them around in the z axis. This doesn't change where they draw or how they look, but it does change which shapes are drawn on top of which. Your cubestack shapes works better if you dictate which cubes are on top and which are behind:

Code: Select all

startshape CUBESTACK 

rule CUBESTACK { 
  CUBE {s 0.5} 
  NEXTCUBE { x -.42 y -.24 z 1 } 
  NEXTCUBE { x .42 y -.24 z 1 } 
  NEXTCUBE { y .48 z 1} 
} 

rule NEXTCUBE .33 { 
  CUBESTACK {} 
} 

rule NEXTCUBE .67 { 
} 

rule CUBE { 
	SQUARE [r  15 skew 15 15 x 0.5 y -0.5]
	SQUARE [r 135 skew 15 15 x 0.5 y -0.5]
	SQUARE [r 255 skew 15 15 x 0.5 y -0.5]
	SQUARE [r  15 skew 15 15 x 0.5 y -0.5 s 0.8 b 0.4]
	SQUARE [r 135 skew 15 15 x 0.5 y -0.5 s 0.8 b 0.8]
	SQUARE [r 255 skew 15 15 x 0.5 y -0.5 s 0.8 b 0.6]
} 
(I also took liberties with your CUBE rule.)

shevegen
Posts: 57
Joined: Wed Jul 06, 2005 5:38 am

Post by shevegen »

very cool idea, reminds me of the html/css z-index layer specification
for block elements

maybe we see some cfdg's which combine other cfdg's into
something creative or complex

Post Reply