【发布时间】:2023-04-19 09:16:01
【问题描述】:
我正在尝试绘制 UIBezierPaths 并将它们显示在 SCNPlane 上,尽管我得到了一个非常不清晰的结果 (See in the image) 我怎样才能使它更清晰?
let displayLayer = CAShapeLayer()
displayLayer.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
displayLayer.path = path.cgPath
displayLayer.fillColor = UIColor.clear.cgColor
displayLayer.strokeColor = stroke.cgColor
displayLayer.lineWidth = lineWidth
let plane = SCNPlane(width:size.width, height: size.height)
let material = SCNMaterial()
material.diffuse.contents = displayLayer
plane.materials = [material]
let node = SCNNode(geometry: plane)
我尝试增加 displayLayer.frame 的大小,但它只会让事情变得更小。
感谢您的回答! 安德拉斯
【问题讨论】:
-
更改图层的框架是个好主意,因为它会导致更大的纹理来映射对象。您需要将 Bézier 路径缩放相同的数量,以使其显示为相同的大小。
标签: ios core-animation calayer scenekit cashapelayer