-
Notifications
You must be signed in to change notification settings - Fork 3
ExampleFiveRings
Li, Xizhi edited this page Dec 19, 2016
·
2 revisions
-- 奥运五环
local radius = 10;
local inner_radius = radius * 0.8;
local thickness = 4; -- thickness
local rings = {
{pos = {-22, 0, 0 }, color="red"},
{pos = {-11, 0, -9 }, color="green"},
{pos = {0, 0, 0 }, color="black"},
{pos = {11, 0, -9 }, color="yellow"},
{pos = {22, 0, 0 }, color="blue"},
}
local function CreateRing(pos, c)
push();
color(c);
translate(pos);
difference();
cylinder({ r = radius, h = thickness });
cylinder({ r = inner_radius, h = thickness } );
pop();
end
union();
scale(0.2);
for i=1, #rings do
local ring = rings[i];
CreateRing(ring.pos, ring.color);
end