Decreasing level of brightness

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

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
archpaladin1
Posts: 2
Joined: Wed Aug 05, 2009 11:32 am

Decreasing level of brightness

Post by archpaladin1 »

I have a simple recursive shape:

Code: Select all

startshape start

rule start {
	SQUARE {
		sat .7
		hue 50
		brightness 0
	}
	start {
		rotate -5
		size .9
		brightness .1
	}
}
This shape goes from dark to light. I would like to go the other way - from light to dark. I would think that this would work:

Code: Select all

startshape start


rule start {
	SQUARE {
		sat .7
		hue 50
		brightness 1
	}
	start {
		rotate -5
		size .9
		brightness -.1
	}
}
It doesn't. Instead I just get a yellow square. What do I need to do to recursively lower the brightness level?

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

Post by MtnViewJohn »

You first have to increase the darkness level before you can decrease it. Sat, hue, and brightness do not set the color components to the following value, they modify the current color.

Code: Select all

startshape brightstart 

rule brightstart {
   start {
      brightness 1
   }
}

rule start { 
   SQUARE { 
      sat .7 
      hue 50 
      brightness 0 
   } 
   start { 
      rotate -5 
      size .9 
      brightness -.1 
   } 
} 

archpaladin1
Posts: 2
Joined: Wed Aug 05, 2009 11:32 am

Post by archpaladin1 »

So if I'm understanding you correctly, it sounds like the hue, sat, and brightness modifiers perform different operations based on where they are, and I had them in the wrong location.

Incidentally, the following also works, which cuts down on irrelevant attributes and is closer to what I was originally thinking.

Code: Select all

startshape brightstart

rule brightstart {
   start {
      sat .7
      hue 50
      brightness 1
   }
}

rule start {
   SQUARE {   }
   start {
      rotate -5
      size .9
      brightness -.1
   }
}
Thanks for the help.

Post Reply