Thread

Index > Scripting > example variable length connected (menu?)boxes
Author/Date example variable length connected (menu?)boxes
exosceleton
16/01/2008 6:51pm
still thinking about possibilities of implementing gradients, incorporate text and providing html map code in the output, but for now, the basic:


---------------Start script----------

h=32;
w=145;
thick=3;
gap=8;
rad=8;
numberofreps=6;
colorR=0;
colorG=80;
colorB=200;

startx=w/2+gap/2;
starty=h+16-thick;
stopx=startx+16;
stopy=starty-16;
unitheight=h+(2*rad-2*thick);

create (w,numberofreps*unitheight-(2*rad-2*thick),32);

//backgroundcolor
newpath (q);
rgb(200, 200,200);
rect (q,0,0,250,500);
fillpath (q);

for(t1=0;t1<numberofreps;t1++)
{
// Border
newpath (p);
rgb(colorR,colorG,colorB);
roundrect (p, 0, t1*(h+(2*rad-2*thick)),w,t1*(h+2*rad-2*thick)+h, rad);
roundrect (p, thick,t1*(h+2*rad-2*thick)+thick, w - thick,t1*(h+2*rad-2*thick)+ h- thick, rad - thick);

fillpath (p);
}

for(t1=0;t1<numberofreps-1;t1++)
{
//making a few holes
newpath(p);
rgb(200,200,200);
rect(p,w/2-rad-gap/2,(t1*unitheight)+h-thick,w/2+rad+gap/2,(t1*unitheight)+h);
rect(p,w/2-rad-gap/2,((t1+1)*unitheight),w/2+rad+gap/2,((t1+1)*unitheight)+thick);
fillpath(p);

//code for top left cornerlike curve
startx=w/2+gap/2;
starty=(t1*unitheight)+h+rad-thick;
stopx=startx+rad;
stopy=starty-rad;
newpath(i);
setfillrule(i,nonzero);
rgb(colorR,colorG,colorB);
moveto(i,startx,starty);
quadto(i,startx+1,stopy+1,stopx,stopy);
lineto(i,stopx,stopy+thick);
quadto(i,startx+1+thick,stopy+1+thick,startx+thick,starty);

fillpath(i);




//code for bottom left cornerlike curve
startx=w/2+gap/2;
starty=(t1*unitheight)+h+rad-thick;
stopx=startx+rad;
stopy=starty+rad;
newpath(i);
setfillrule(i,nonzero);
rgb(colorR,colorG,colorB);
moveto(i,startx,starty);
quadto(i,startx+1,stopy-1,stopx,stopy);
lineto(i,stopx,stopy-thick);
quadto(i,startx+1+thick,stopy-1-thick,startx+thick,starty);

fillpath(i);

//code for top right cornerlike curve
newpath(i);
startx=w/2-gap/2;
starty=(t1*unitheight)+h+rad-thick;
stopx=startx-rad;
stopy=starty-rad;
setfillrule(i,nonzero);
rgb(colorR,colorG,colorB);
moveto(i,startx,starty);
quadto(i,startx-1,stopy-1,stopx,stopy);
lineto(i,stopx,stopy+thick);
quadto(i,startx-1-thick,stopy+1+thick,startx-thick,starty);
fillpath(i);

//code for top right cornerlike curve
newpath(i);
startx=w/2-gap/2;
starty=(t1*unitheight)+h+rad-thick;
stopx=startx-rad;
stopy=starty+rad;
setfillrule(i,nonzero);
rgb(colorR,colorG,colorB);
moveto(i,startx,starty);
quadto(i,startx-1,stopy-1,stopx,stopy);
lineto(i,stopx,stopy-thick);
quadto(i,startx-1-thick,stopy-1-thick,startx-thick,starty);
fillpath(i);
}

------------------end script---------
makes:

exosceleton
16/01/2008 6:53pm
attempt 2
fret
16/01/2008 9:26pm
Nice, you got the curves happening. :)
exosceleton
21/01/2008 6:25am
something happened to the image in the post above.
fret
21/01/2008 6:31am
whats the right url?
exosceleton
21/01/2008 6:37am
it's fine now. Am i crazy or did you do something?
Reply