Class RoundedCornersContent

    • Method Detail

      • modifyShape

        public ShapeData modifyShape​(ShapeData startingShapeData)
        Rounded corner algorithm: Iterate through each vertex. If a vertex is a sharp corner, it rounds it. If a vertex has control points, it is already rounded, so it does nothing.

        To round a vertex: Split the vertex into two. Move vertex 1 directly towards the previous vertex. Set vertex 1's in control point to itself so it is not rounded on that side. Extend vertex 1's out control point towards the original vertex.

        Repeat for vertex 2: Move vertex 2 directly towards the next vertex. Set vertex 2's out point to itself so it is not rounded on that side. Extend vertex 2's in control point towards the original vertex.

        The distance that the vertices and control points are moved are relative to the shape's vertex distances and the roundedness set in the animation.

        Specified by:
        modifyShape in interface ShapeModifierContent