I'm trying to animate SCNView height, but it seems like there are some visual issue.
When content is growing it looks like everything is ok, but when I'm trying to decrease the height, view just jumps to final height instantly.
let newHeight = scene.frame.height + (open ? 100.0 : -100.0)
UIView.animate(withDuration: 1.0, animations: {
self.scene.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: newHeight)
}) { finished in
self.open = !self.open
}
With regular view everything works fine.
Set contentMode
of SCNView
to .scaleToFill
where needed (e.g. in viewDidLoad
). It works as expected.
let view: SCNView
...
view.contentMode = .scaleToFill