Swift   发布时间:2022-04-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了swift3 – 带#keyPath的CATransform3D密钥路径大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
是否可以使用增强的密钥路径(如 here所述)为Swift 3中的CATransform3D属性添加新的#keyPath关键字?

换句话说就是替换

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

喜欢的东西

let scaleAnimation = CABasicAnimation(keyPath:  #keyPath(CALayer.transform.???))
@H_419_22@解决方法
应该使用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密钥路径所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。