我用这个在 OC 中使用这个函数
CAMediaTimingFunction *function = [CAMediaTimingFunction functionWithName:
kCAMediaTimingFunctionDefault];
//get control points
CGPoint controlPoint1, controlPoint2;
[function getControlPointAtIndex:1 values:(float *)&controlPoint1];
[function getControlPointAtIndex:2 values:(float *)&controlPoint2];
NSLog(@"%@, %@", NSStringFromCGPoint(controlPoint1), NSStringFromCGPoint(controlPoint2));
//{5.2386907149499368e-11, 7.9050503334599447e-323}, {0.0078125018189894035, 4.9406564584124654e-324}
但是如何将其转换为swift3.1,我这样做了,但是出了点问题!
let timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionDefault)
var point1 = Float(0.0), point2 = Float(0.0)
timingFunction.getControlPoint(at: 1, values: &point1)
timingFunction.getControlPoint(at: 2, values: &point2)
print("\(String(describing: point1)),\(String(describing: point2))")
// 0.25,0.25
如何解决?我需要一些帮助,拜托。注意代码打印。