rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

overlay with animation not work? #SCVideoOverlay# #Animation# #CALayer# #395

Closed lvpengwei closed 7 years ago

lvpengwei commented 7 years ago
class StickerExportView: UIView, SCVideoOverlay {

    fileprivate var animationLayer: CALayer
    init(animationLayer: CALayer) {
        self.animationLayer = animationLayer
        super.init(frame: .zero)
        animationLayer.beginTime = 0
        animationLayer.speed = 0
        layer.addSublayer(animationLayer)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    func update(withVideoTime time: TimeInterval) {
        animationLayer.timeOffset = time
    }

}

The animationLayer's sublayers has some animation.

lvpengwei commented 7 years ago

func render(in ctx: CGContext) This method renders directly from the layer tree, ignoring any animations added to the render tree. Renders in the coordinate space of the layer.

https://developer.apple.com/reference/quartzcore/calayer/1410909-render