CABasicAnimation in Swift Playground

妖精的绣舞 提交于 2019-12-01 04:13:25
Joseph Chen

The first part of the solution is to enable the Run in Full Simulator option. See this answer for a step-by-step.

The second part of the solution is to contain your animated view in a container view, e.g.:

let container = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
XCPShowView("Circle Animation", container)
let test = timerButtonGraphics(frame: CGRect(x: 198, y: 0, width: 4, height: 400))
container.addSubview(test)

The third part of the solution is to correct your animation. The keyPath should be transform.scale.x instead of scale.x and you need to add a duration, e.g.:

anim.keyPath = "transform.scale.x"
anim.duration = 5

You should then be able to view the animation in your playground.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!