0
我這個用戶功能OC與此如何使用 「getControlPoint(IDX處:詮釋,值PTR:UnsafeMutablePointer <Float>!)」 CAMediaTimingFunction
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
如何解決?我需要一些幫助。注意代碼打印。