2 Replies
      Latest reply on Oct 26, 2017 1:38 AM by quentinf
      Yaali Level 1 Level 1 (0 points)

        I am working on an AR application in which i am rendering a 3D model.


        Upon tapping a child node i am displaying a gif image by creating animation using CALayer and loading it in diffuse.contents by following this thread https://stackoverflow.com/questions/24125701/set-contents-of-calayer-to-animated-gif/41646638#41646638


                    let animation : CAKeyframeAnimation = createGIFAnimation(url: gifImageURL!)!

                    let layer = CALayer()

                    layer.bounds = CGRect(x: 0, y: 0, width:600, height:200)

                    layer.add(animation, forKey: "contents")


                    let newMaterial = SCNMaterial()

                    newMaterial.isDoubleSided = true

                    newMaterial.diffuse.contents = layer

                    let plane = SCNPlane(width: 5, height: 5)

                    plane.materials = [newMaterial]

                    let node = SCNNode(geometry: plane)



        I am able to render the gif image in SCNNode but it is displaying only half of it(Right bottom most portion of gif is only visible). I tried below steps to rectify this but still in vain

        • Changing Plane's width/height
        • Changing the bounds of CALayer
        • Tried with different sizes of gif image


        Anyone please help me how to render a full gif image in SCNPlane using CALayer.