CFDG question

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
philomel
Posts: 2
Joined: Wed Oct 04, 2006 12:00 am

CFDG question

Post by philomel »

Hi, I just needed a little bit of help on getting a project I'm working on to look right, but I can't seem to come up with the code to make delicate star shaped petals on the edges of the branches in the code. Any suggestions?

Code: Select all

startshape TREES
background { hue 110.3 sat 0.7 b 0.9  }

rule TREES {
	BRANCH { }
	BRANCH { flip 90 }
}

rule SHAPE { SQUARE { } }
rule SHAPE 0.01 {
	SQUARE { }
	
}

rule BRANCH {
	SHAPE { hue 38.3 sat 0.9 b 0.4 }
	BRANCH { y 0.90 s 0.99 r 0.5 }
}

rule BRANCH 0.08 {
	BRANCH { flip 85 }
}


rule BRANCH 0.32 {
	BRANCH { flip 90 }
}


rule BRANCH 0.01 {
	BRANCH {flip 90}
}

rule BRANCH 0.25 {
	BRANCH {flip 90}

}

rule BRANCH 0.05 { 
	BRANCH { s 0.85 r 15 }
	BRANCH { s 0.80 r -15 }
}

What commands do I need to enter?

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

Post by MtnViewJohn »

Try this:

Code: Select all

startshape redflower

rule arc {
	75* { r 1 x 0.1 } TRIANGLE {r -7}
}

rule petal {
	arc {r -36.5}
	arc {flip 0 r 36.5}
	petal {sat -0.025  s 0.95 x -0.025}
}

rule flower {
	5* {r 72} petal{}
}

rule redflower {
	flower {b 0.9 sat 0.9 h 60 r 36 s 0.1 z 1}
	flower {b 1 sat 1}
}

philomel
Posts: 2
Joined: Wed Oct 04, 2006 12:00 am

Post by philomel »

OK, we've got these two together...now how do we link them? Everytime I try to link up the codes, I get black arcs. What am I doing wrong here?

Joe

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

Post by MtnViewJohn »

I added this code to the end of your cfdg file:

Code: Select all

rule BRANCH 0.01 {
	redflower{r 36}
	BRANCH {}
}

rule arc { 
   75* { r 1 x 0.1 } TRIANGLE {r -7} 
} 

rule petal { 
   arc {r -36.5} 
   arc {flip 0 r 36.5} 
   petal {sat -0.025  s 0.95 x -0.025} 
} 

rule flower { 
   5* {r 72} petal{} 
} 

rule redflower { 
   flower {b 0.9 sat 0.9 h 60 r 36 s 0.1 z 1} 
   flower {b 1 sat 1} 
}

Post Reply