Xmas Tree...

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
User avatar
mtnviewmark
Site Admin
Posts: 81
Joined: Wed May 04, 2005 12:46 pm
Location: Mountain View, CA
Contact:

Xmas Tree...

Post by mtnviewmark »

In another post, yevgen said "Imagine you write a program to draw Xmas-tree with candles. ...",

There are so many reasons not to do this:
  • 'Tisn't the season
  • CFDG is just plainly the wrong tool for the job
  • It doesn't really counter the desire for absolute values in rules
  • I just celebrated Passover!
But, I couldn't help myself...

Code: Select all

startshape Tree

rule Tree {
	Pine { }
	Star { y 16 b 0.5 s 0.5 }
	CandlesL { y 3 s 0.8 }
	CandlesR { y 3.5 s 0.8 }
}

rule Pine {
	Trunk { }
	BranchesL { y 3 s 0.8 }
	BranchesR { y 3.5 s 0.8 }
}
rule Trunk {
	SQUARE { }
	Trunk { y 0.4 s 0.975 }
}
rule BranchesL {
	Pine { r 80 s 0.5 }
	BranchesL { y 3 s 0.815 }
}
rule BranchesR {
	Pine { r -80 s 0.5 }
	BranchesR { y 3 s 0.81 }
}

rule CandlesL {
	Candle { x -6.5 y 1.2 s 0.4 }
	CandlesL { y 3 s 0.815 }
}
rule CandlesR {
	Candle { x 6.5 y 1.2 s 0.4 }
	CandlesR { y 3 s 0.81 }
}
rule Candle {
	SQUARE { y 0 }
	SQUARE { y 0.7 }
	SQUARE { y 1.4 }
	SQUARE { y 2 }
	Flame { y 3.1 b 0.3 }
	Ray { y 3.6 s 0.5 b 0.5 }
}
rule Flame {
	CIRCLE { }
	Flame { y 0.15 s 0.9 b 0.1 r 2 }
}

rule Star {
	Arm { r 0 }
	Arm { r 72 }
	Arm { r 144 }
	Arm { r -72 }
	Arm { r -144 }
	Ray { b 0.7 r 180 }
}
rule Arm {
	CIRCLE { }
	Arm { y 0.1 s 0.9 }
}
rule Ray {
	Line { y 8 s 0.2 }
	Ray { r -36 s 0.97 }
}
rule Line {
	SQUARE { }
	Line { y 0.8 s 0.9 }
}
Warning: Very shape intensive!
I'm the "m" in "mtree.cfdg"

User avatar
chris
Site Admin
Posts: 72
Joined: Wed May 04, 2005 10:57 am
Location: New York, NY
Contact:

Post by chris »

I love it. Especially the candle flames.

If we ever put opacity in this language, I think a cool looking camp fire would be totally feasible.
Current Project: I'm creative director of OKCUPID at http://www.okcupid.com

bigelectricat
Posts: 19
Joined: Fri May 06, 2005 8:43 am

Post by bigelectricat »

wow, amazing! now how about making a christmas wreath? with flowers in the bottom and three candles in the center? just kidding!

:P

Post Reply