I added CALayer to the image by doing the following:
var menulayer = CALayer()
menulayer.frame = CGRectMake(0.0, 0.0, menuimage.frame.size.width, menuimage.frame.size.height);
menulayer.backgroundColor = bartint.CGColor
menulayer.opacity = 1
menuimage.layer.addSublayer(menulayer)
I want to animate a layer so that it displays an image from left to right. I tried this:
let width = CGFloat(0)
CATransaction.begin()
CATransaction.setAnimationDuration(2.0)
self.menulayer.bounds = CGRectMake(0, 0, width , 50)
CATransaction.commit()
But the animation starts in the center of the image, how can I start it from the left edge of the image?
source
share