Class RoundedCornersContent
- java.lang.Object
-
- com.airbnb.lottie.animation.content.RoundedCornersContent
-
- All Implemented Interfaces:
Content,ShapeModifierContent,BaseKeyframeAnimation.AnimationListener
public class RoundedCornersContent extends Object implements ShapeModifierContent, BaseKeyframeAnimation.AnimationListener
-
-
Constructor Summary
Constructors Constructor Description RoundedCornersContent(LottieDrawable lottieDrawable, BaseLayer layer, RoundedCorners roundedCorners)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()BaseKeyframeAnimation<Float,Float>getRoundedCorners()ShapeDatamodifyShape(ShapeData startingShapeData)Rounded corner algorithm: Iterate through each vertex.voidonValueChanged()voidsetContents(List<Content> contentsBefore, List<Content> contentsAfter)
-
-
-
Constructor Detail
-
RoundedCornersContent
public RoundedCornersContent(LottieDrawable lottieDrawable, BaseLayer layer, RoundedCorners roundedCorners)
-
-
Method Detail
-
onValueChanged
public void onValueChanged()
- Specified by:
onValueChangedin interfaceBaseKeyframeAnimation.AnimationListener
-
setContents
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter)
- Specified by:
setContentsin interfaceContent
-
getRoundedCorners
public BaseKeyframeAnimation<Float,Float> getRoundedCorners()
-
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:
modifyShapein interfaceShapeModifierContent
-
-