Closed rextremotabaresDtt closed 1 year ago
Hi @buba447 I've looked into this issue and found that within the AnimationContainer
and the layers does not care about the bounds stated in the animation json file. (I'm talking about AnimationContainer.swift:117
)
We are setting the bounds for this CALayer but does not set the layer to mask itself to the bounds therefore the images and other layers can be rendered outside the stated bounds. Is this intentional? or would you like me to send a PR for this?
@rextremotabaresDtt the work around for your current issue is to explicitly state the width and height of the animationView
as per your requirement.
example:
animationView.topAnchor.constraint(equalTo: self.ivDiagram.topAnchor).isActive = true
animationView.leadingAnchor.constraint(equalTo: self.ivDiagram.leadingAnchor).isActive = true
animationView.heightAnchor.constraint(equalToConstant: 332).isActive = true
animationView.trailingAnchor.constraint(equalTo: self.ivDiagram.trailingAnchor).isActive = true
(no need for bottom anchor, set the height explicitly) and then add
animationView.clipsToBounds = true
I have tried this and it works
Thank you @ferico55 I've tried setting the height specifically and it works! As a work around works perfect, thank you!
I am currently struggling with an issue in some animations our designer is creating for me with Lottie (she is using After Effects with BodyMovin plugin, the result of the animation is provided in the zip file). In Android and LottiePreview the animation plays fine, rendering only the part inside the colored rectangle and some text above but in iOS, the animation is drawing itself outside the bounding rectangle and there is an extra padding above the animation. What are we doing wrong? I assume this is something that needs to be done in AE but my designer doesn't know what to do to fix it.
Check these before submitting:
This issue is a:
Which Version of Lottie are you using?
Lottie 3.0
What Platform are you on?
What Language are you in?
Expected Behavior
Actual Behavior
Code Example
Animation JSON
animation.zip