It looks like you're new here. If you want to get involved, click one of these buttons!
RoundedRectangle = Core.class( Path2D ) function RoundedRectangle:init( width,height,radius ) local diameter = radius*2 if width < height then if diameter > width then radius = width/2 end else if diameter > height then radius = height/2 end end width = width-(radius*2) height = height-(radius*2) local x = radius local svg_path = "M" .. x .. ",0 h" .. width .. " a" .. radius .. "," .. radius .. " 0 0 1 " .. radius .. "," .. radius .. " v" .. height .. " a" .. radius .. "," .. radius .. " 0 0 1 -" .. radius .. "," .. radius .. " h-" .. width .. " a" .. radius .. "," .. radius .. " 0 0 1 -" .. radius .. ",-" .. radius .. " v-" .. height .. " a" .. radius .. "," .. radius .. " 0 0 1 " .. radius .. ",-" .. radius .. " z" self:setSvgPath(svg_path) end |
Likes: SinisterSoft, pie, antix, Apollo14