I have a simple LottieAnimationView
and I would like to rotate it by 90 degrees, but .transform
has no impact. It is being displayed but the transform is not being applied.
This is how I set it up:
self.view.addSubview(arrowAnimation)
arrowAnimation.translatesAutoresizingMaskIntoConstraints = false
arrowAnimation.heightAnchor.constraint(equalToConstant: screenSize.width/3).isActive = true
arrowAnimation.bottomAnchor.constraint(equalTo: introLabel.topAnchor, constant: -20).isActive = true
arrowAnimation.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
arrowAnimation.contentMode = .scaleAspectFit
arrowAnimation.transform.rotated(by: .pi / 2)
arrowAnimation.animationSpeed = 1.5
arrowAnimation.loopMode = .playOnce
Any idea why the transform
is not working here?
the below will work:
As to the why:
the .transform.rotated(by: .pi/2) returns a transformation, but does not apply it, so you would need to instead do: