|
|
Vector Shape - Rounded Rectangle
Added on 5/30/2007
|
pass the handler the width, height, and radius of the rounded edge and it will create a rounded rectangle.
on createRectangle (width, height, corner)
ch = corner/2.0
pt1 = [#vertex: point(0, corner), #handle1: point(0, -ch), #handle2: point(0,0)]
pt2 = [#vertex: point(corner, 0), #handle1: point(0,0), #handle2: point(-ch,0)]
pt3 = [#vertex: point(width - corner, 0), #handle1: point(ch,0), #handle2: point(-ch,0)]
pt4 = [#vertex: point(width, corner), #handle1: point(0,0), #handle2: point(0, -ch)]
pt5 = [#vertex: point(width, height - corner), #handle1: point(0,ch), #handle2: point(0,0)]
pt6 = [#vertex: point(width - corner, height), #handle1: point(0,0), #handle2: point(ch,0)]
pt7 = [#vertex: point(corner, height), #handle1: point(-ch,0), #handle2: point(0,0)]
pt8 = [#vertex: point(0, height - corner), #handle1: point(0,0), #handle2: point(0,ch)]
vertList = [pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8]
return vertList
end
|
|