我想在UIView上执行透视变换(例如在coverflow中看到)
有谁知道这是否可能?
我已经调查过使用CALayer并且已经完成了所有实用的程序员Core Animation播客,但我仍然不清楚如何在iPhone上创建这种转换.
任何帮助,指针或示例代码片段将非常感谢!
我有一个以编程方式创建的平面,我想获得该平面所具有的一个顶点的坐标.像这样的东西:print(Plane.vertices[1].position)它可能会打印如下:(x:1,y:1),并print(Plane.vertices[2].position)打印(x - 1,y:1)
let positions = [SCNVector3Make( 0, -0.1, 0),
SCNVector3Make( 0.3, -0.1, 0),
SCNVector3Make( 0, 0.1, 0),
SCNVector3Make( 0.3, 0.1, 0),
]
let indices :[UInt16] = [
0, 1, 2,
1, 3, 2,
]
let vertexSource = SCNGeometrySource(vertices: positions, count: 4)
let indexData = NSData(bytes: indices, length: MemoryLayout<CInt>.size * indices.count)
let newElement = SCNGeometryElement(data: NSData(bytes: indices, length: indices.count * MemoryLayout<Int16>.size) as Data, primitiveType: .triangles , primitiveCount: 2, bytesPerIndex: MemoryLayout<Int16>.size)
let geometry = SCNGeometry(sources: [vertexSource], …Run Code Online (Sandbox Code Playgroud)