Multiple strokes in randomized paths

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

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
Ryk
Posts: 3
Joined: Sun Feb 05, 2012 3:34 am

Multiple strokes in randomized paths

Post by Ryk »

I am trying to make paths using multiple strokes with different stroke widths. This works on paths with predetermined parameters, but when doing so on random paths only the first stroke width is used.

Code: Select all

startshape Scene

shape Scene{
	randSquiggle []
	Squiggle [x 6]
}

path randSquiggle {
	MOVETO(0,0)	
	
	// one parameter randomized
	CURVETO(1..5,5,9,2)

	STROKE(0.2) []
	STROKE(0.02) [y 1 b 0.5]	
}


path Squiggle {
	MOVETO(0,0)	
	
	//no randomization
	CURVETO(7,5,9,2)

	STROKE(0.2) []
	STROKE(0.02) [y 1 b 0.5]	
}
The random curve on the left will use the first width on both strokes whereas the one on the left uses both widths as specified. Is there a solution to this?

Thanks!

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

Re: Multiple strokes in randomized paths

Post by MtnViewJohn »

It's one of those situations where an uninitialized piece of memory happens to have the worst possible value in it. I fixed the initializer, but I don't think there is a work-around for v2beta2. v3beta3 is coming out soon. I just have one more bug to fix.

Ryk
Posts: 3
Joined: Sun Feb 05, 2012 3:34 am

Re: Multiple strokes in randomized paths

Post by Ryk »

Nice!

Thanks for the work you are putting into the program! I've had a great time using it.

Ryk
Posts: 3
Joined: Sun Feb 05, 2012 3:34 am

Re: Multiple strokes in randomized paths

Post by Ryk »

Found another issue. When using multiple STROKEs, they might not respect differing z values:

Code: Select all

startshape Squiggle

path Squiggle {
	MOVETO(0,0)
	LINETO(1,1)
	
	//red line at z 5
	STROKE() [b 1 sat 1 h 0 z 5]


	//blue line at z 0
	STROKE() [r 90 x 1 b 1 sat 1 h 180 z 0]

}

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

Re: Multiple strokes in randomized paths

Post by MtnViewJohn »

That is by design. All the components of a path z-order together. It should issue a warning though. And this should be documented.

Post Reply