swift3 – 带#keyPath的CATransform3D密钥路径

swift3 – 带#keyPath的CATransform3D密钥路径,第1张

概述是否可以使用增强的密钥路径(如 here所述)为Swift 3中的CATransform3D属性添加新的#keyPath关键字? 换句话说就是替换 let scaleAnimation = CABasicAnimation(keyPath: "transform.scale") 喜欢的东西 let scaleAnimation = CABasicAnimation(keyPath: #keyPa 是否可以使用增强的密钥路径(如 here所述)为Swift 3中的CAtransform3D属性添加新的#keyPath关键字?

换句话说就是替换

let scaleAnimation = CABasicAnimation(keyPath: "transform.scale")

喜欢的东西

let scaleAnimation = CABasicAnimation(keyPath:  #keyPath(CALayer.transform.???))
解决方法 应该使用CAValueFunction.

let scaleAnimation = CABasicAnimation(keyPath: "transform.scale")

– >

let scaleAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.transform))scaleAnimation.valueFunction = CAValueFunction(name: kCAValueFunctionScale)

let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation")

– >

let rotationAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.transform))rotationAnimation.valueFunction = CAValueFunction(name: kCAValueFunctionRotateZ)

等等

> rotation.x – > kCAValueFunctionRotateX> rotation.y – > kCAValueFunctionRotateY> rotation.z – > kCAValueFunctionRotateZ>旋转 – > kCAValueFunctionRotateZ> scale.x – > kCAValueFunctionScaleX> scale.y – > kCAValueFunctionScaleY> scale.z – > kCAValueFunctionScaleZ>规模 – > kCAValueFunctionScale> translation.x – > kCAValueFunctionTranslateX> translation.y – > kCAValueFunctionTranslateY> translation.z – > kCAValueFunctionTranslateZ>翻译 – > kCAValueFunctionTranslate

总结

以上是内存溢出为你收集整理的swift3 – 带#keyPath的CATransform3D密钥路径全部内容,希望文章能够帮你解决swift3 – 带#keyPath的CATransform3D密钥路径所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1004568.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存