Starting in the distance and drawing in the foreground

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

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
Ebola_One
Posts: 4
Joined: Tue Jul 12, 2005 9:45 pm
Location: Noo Zo'lund

Starting in the distance and drawing in the foreground

Post by Ebola_One »

I have written this CFDG file:

Code: Select all

startshape BEGIN

rule BEGIN {
   DRAW {}
}

rule DRAW {
   PERSON {}
   DRAW { y 1 r 20 x 1 size 0.99 }
}

rule PERSON 1 {
   CIRCLE {}
   SQUARE { y -1 b 0.7}
   SQUARE { y -1.7 b 0.4 size 0.8 0.4 }
   SQUARE { y -0.85 x -0.6 b 0.75 size 0.2 0.6 }
   SQUARE { y -0.85 x 0.6 b 0.75 size 0.2 0.6 }
   CIRCLE { y -1.25 x 0.6 size 0.2 0.2 }
   CIRCLE { y -1.25 x -0.6 size 0.2 0.2 }
}

rule PERSON 0.5 {
   CIRCLE { b 0.45 }
   SQUARE { y -1 b 0.7}
   SQUARE { y -1.7 b 0.4 size 0.8 0.4 }
   SQUARE { y -0.85 x -0.6 b 0.75 size 0.2 0.6 }
   SQUARE { y -0.85 x 0.6 b 0.75 size 0.2 0.6 }
   CIRCLE { y -1.25 x 0.6 size 0.2 0.2 }
   CIRCLE { y -1.25 x -0.6 size 0.2 0.2 }
}
But it's not drawing how I'd really like it to, I'd like the people objects to draw over the previous layer, starting small in the center & spiraling outwards

Can anyone help?

User avatar
lagroue
Posts: 114
Joined: Wed Jul 06, 2005 11:33 pm
Location: Paris, France
Contact:

Post by lagroue »

It's a topic on itself, but, basically, shapes created after others are drawn after them.

So, instead of making your people vanishing, you can make them draw bigger, and add a stop rule so that the infinite process will eventually stop :

Code: Select all

startshape BEGIN 

rule BEGIN { 
   DRAW {} 
} 

// bigger
rule DRAW { 
   PERSON {} 
   DRAW { y 1 r 20 x 1 size 1.01 }
} 

// sometimes stops
rule DRAW 0.01 { 
}

rule PERSON 1 { 
   CIRCLE {} 
   SQUARE { y -1 b 0.7} 
   SQUARE { y -1.7 b 0.4 size 0.8 0.4 } 
   SQUARE { y -0.85 x -0.6 b 0.75 size 0.2 0.6 } 
   SQUARE { y -0.85 x 0.6 b 0.75 size 0.2 0.6 } 
   CIRCLE { y -1.25 x 0.6 size 0.2 0.2 } 
   CIRCLE { y -1.25 x -0.6 size 0.2 0.2 } 
} 

rule PERSON 0.5 { 
   CIRCLE { b 0.45 } 
   SQUARE { y -1 b 0.7} 
   SQUARE { y -1.7 b 0.4 size 0.8 0.4 } 
   SQUARE { y -0.85 x -0.6 b 0.75 size 0.2 0.6 } 
   SQUARE { y -0.85 x 0.6 b 0.75 size 0.2 0.6 } 
   CIRCLE { y -1.25 x 0.6 size 0.2 0.2 } 
   CIRCLE { y -1.25 x -0.6 size 0.2 0.2 } 
}

Ebola_One
Posts: 4
Joined: Tue Jul 12, 2005 9:45 pm
Location: Noo Zo'lund

Post by Ebola_One »

Ahhh I see, so by making the current object bigger than the last, it'll naturally push the smaller object into the background, as the current object is the true 1:1 scale object (not taking into account the actual screen size of the object, as the image is scaled to fit on screen)

Code: Select all

startshape BEGIN

rule BEGIN {
   DRAW {}
}

// bigger
rule DRAW {
   PERSON {}
   DRAW { y 1 r 20 x 1 size 1.01 }
}

// sometimes stops
rule DRAW 0.001 {
}

rule PERSON 1 {
   CIRCLE {}
   SQUARE { y -1.7 b 0.1 size 0.81 0.41 }
   SQUARE { y -1.7 b 0.4 size 0.8 0.4 }
   SQUARE { y -1 size 1.01 b 0.05 }
   SQUARE { y -1 b 0.7}
   SQUARE { y -0.85 x -0.6 size 0.21 0.61 b 0.05 }
   SQUARE { y -0.85 x 0.6 size 0.21 0.61 b 0.05 }
   SQUARE { y -0.85 x -0.6 b 0.75 size 0.2 0.6 }
   SQUARE { y -0.85 x 0.6 b 0.75 size 0.2 0.6 }
   CIRCLE { y -1.25 x 0.6 size 0.2 0.2 }
   CIRCLE { y -1.25 x -0.6 size 0.2 0.2 }
}

rule PERSON 0.5 {
   CIRCLE { b 0.45 }
   SQUARE { y -1.7 b 0.1 size 0.81 0.41 }
   SQUARE { y -1.7 b 0.4 size 0.8 0.4 }
   SQUARE { y -1 size 1.01 b 0.05 }
   SQUARE { y -1 b 0.7}
   SQUARE { y -0.85 x -0.6 size 0.21 0.61 b 0.05 }
   SQUARE { y -0.85 x 0.6 size 0.21 0.61 b 0.05 }
   SQUARE { y -0.85 x -0.6 b 0.75 size 0.2 0.6 }
   SQUARE { y -0.85 x 0.6 b 0.75 size 0.2 0.6 }
   CIRCLE { y -1.25 x 0.6 size 0.2 0.2 }
   CIRCLE { y -1.25 x -0.6 size 0.2 0.2 }
}
That's the effect I was after.

I call it Life Spiral

Cheers for your help! :)

User avatar
lagroue
Posts: 114
Joined: Wed Jul 06, 2005 11:33 pm
Location: Paris, France
Contact:

Post by lagroue »

:) You're welcome !

Post Reply