Wednesday, June 7, 2023
HomeiOS Developmentios - Tips on how to disguise and present a CATextLayers with...

ios – Tips on how to disguise and present a CATextLayers with out animation


I’ve a number of CATextLayers which can be being added to an AVVideoComposition. I wish to disguise and present them at sure time limits within the video. Due to this fact I’ve the next code:

CATransaction.start()
CATransaction.setDisableActions(true)

let startVisible = CABasicAnimation(keyPath: "opacity")
startVisible.fromValue = 0.0
startVisible.toValue = 1.0
startVisible.beginTime = startTime
startVisible.period = 0
startVisible.fillMode = .forwards
startVisible.isRemovedOnCompletion = false
textLayer.add(startVisible, forKey: "startAnimation")
CATransaction.commit()

CATransaction.start()
CATransaction.setDisableActions(true)
let endVisible = CABasicAnimation(keyPath:"opacity")
endVisible.fromValue = 1.0
endVisible.toValue = 0.0
endVisible.beginTime = endTime
endVisible.period = 0
endVisible.fillMode = .forwards
endVisible.isRemovedOnCompletion = false
textLayer.add(endVisible, forKey: "endAnimation")

CATransaction.commit()

This works, nonetheless, it does animate the fade between opacity ranges regardless of CATransaction.setDisableActions(true). How can I modify this in order that the change in opacity is on the spot and never animated?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments