Download or view flag.frink in plain text format
// This draws the American flag using the proper recommended proportions,
// which are rather surprising and make the flag very long and narrow.
// See: http://www.usflag.org/flagspecs.html
// Function to draw a star centered at cx, cy with radius r.
drawStar[g is graphics, cx, cy, r] :=
{
angle = 0 degrees
// Radius of inner points
rr = r (-1 + sqrt[5])/(1+sqrt[5])
p = new filledPolygon[]
for i=1 to 5
{
p.addPoint[cx + r sin[angle], cy - r cos[angle]] // Outer point
p.addPoint[cx + rr sin[angle + 36 degrees], // Inner point
cy - rr cos[angle + 36 degrees]]
angle = angle + 72 degrees
}
g.add[p]
}
g = new graphics
// Draw red stripes
g.color[1,0,0]
for s=0 to 12 step 2
g.fillRectSize[0, 1/13 * s, 1.9, 1/13]
// Draw blue rectangle
g.color[0,0,.5] // Dark Blue
g.fillRectSize[0, 0, 0.76, 7/13]
// Draw stars
g.color[1,1,1] // White
hSpacing = 0.063
vSpacing = 0.054
r = 0.0616/2
// Draw rows of 6
for y=vSpacing to 9 vSpacing step 2 vSpacing
for x= hSpacing to 11 hSpacing step 2 hSpacing
drawStar[g, x, y, r]
// Draw rows of 5
for y=2 vSpacing to 8 vSpacing step 2 vSpacing
for x = 2 hSpacing to 10 hSpacing step 2 hSpacing
drawStar[g, x, y, r]
// Draw outline
g.color[0,0,0]
g.drawRectSize[0, 0, 1.9, 1]
g.show[]
//g.printTiled[2,1]
Download or view flag.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20236 days, 0 hours, 54 minutes ago.