core-animation

How to synchronously animate a UIView and a CALayer

怎甘沉沦 提交于 2021-02-07 04:46:30
问题 To illustrate this question, I gisted a very small Xcode project on Github (two classes, 11kb download). Have a look at the gist here or use git clone git@gist.github.com:93982af3b65d2151672e.git . Please consider the following scenario. A custom view of mine, called 'container view', contains two little squares. Illustrated in this screenshot: The blue square is a 22x22 pt UIView instance and the red square is a 22x22 pt CALayer instance. For purposes of this question I want the two squares

Animating CALayer shadow simultaneously as UITableviewCell height animates

Deadly 提交于 2021-02-07 03:52:22
问题 I have a UITableView that I am attempting to expand and collapse using its beginUpdates and endUpdates methods and have a drop shadow displayed as that's happening. In my custom UITableViewCell, I have a layer which I create a shadow for in layoutSubviews : self.shadowLayer.shadowColor = self.shadowColor.CGColor; self.shadowLayer.shadowOffset = CGSizeMake(self.shadowOffsetWidth, self.shadowOffsetHeight); self.shadowLayer.shadowOpacity = self.shadowOpacity; self.shadowLayer.masksToBounds = NO;

Animating CALayer shadow simultaneously as UITableviewCell height animates

前提是你 提交于 2021-02-07 03:48:13
问题 I have a UITableView that I am attempting to expand and collapse using its beginUpdates and endUpdates methods and have a drop shadow displayed as that's happening. In my custom UITableViewCell, I have a layer which I create a shadow for in layoutSubviews : self.shadowLayer.shadowColor = self.shadowColor.CGColor; self.shadowLayer.shadowOffset = CGSizeMake(self.shadowOffsetWidth, self.shadowOffsetHeight); self.shadowLayer.shadowOpacity = self.shadowOpacity; self.shadowLayer.masksToBounds = NO;

CABasicAnimation - transform scale keep in center

旧巷老猫 提交于 2021-02-06 09:48:05
问题 Trying to animatie an ellipse masked on a UIView to be scale transformed remaining in the center position. I have found CALayer - CABasicAnimation not scaling around center/anchorPoint, and followed by adding a bounds property to the maskLayer CAShapeLayer however, this ends with the mask being positioned in the left corner with only 1/4 of it showing. I would like the mask to remain within the center of the screen. @synthesize maskedView; - (void)viewDidLoad { [super viewDidLoad];

Smoothly rotate and change size of UIView with shadow

拟墨画扇 提交于 2021-02-05 20:28:28
问题 I have a UIView with a shadow and a UIImageView subview. I want to resize the view when the iPad is rotated and I'm trying to do this in the willRotateToInterfaceOrientation callback. If I set the shadow on the UIView in the basic way the rotation is very choppy; so I'd like some suggestions from others on how to set the shadow setting layer.shadowPath. I have tried animating the frame size change using [UIView animateWithDuration:animations] and setting the new shadowPath in the same block,

Resume CABasicAnimation backwards by setting .speed equal to -1

雨燕双飞 提交于 2021-02-05 11:38:53
问题 EDIT : i've refactored the question a bit and solved part of the issue, now the question comes down to why does the presentation layer glitches/flashes when the animation is resumed. At this point tho i'm accepting any answer that makes the animation resume both forwards and backwards at will with no issue. I'm not sure the approach i'm using is the right one, i'm still pretty new to Swift. Note : Sample project at the bottom, for having a better understanding of the issue. In my project i'm

Unexpected behaviour in animation when i change the properties of the model layers

烈酒焚心 提交于 2021-01-29 15:31:14
问题 Referring to this post, i'm trying to adapt the animations to landscape mode. Basically what i want is to rotate all layers of -90° (90° clockwise) and the animations to run horizontally instead of vertically. The author didn't bother to explain the logic under the hood, there are a dozen paper folding libraries in obj-c which are all based on the same architecture, so apparently this is the way to go for folding. EDIT : To further clarify what i want to achieve, here you can look at three

animate a UIView using CADisplayLink 'combined' with CAMediaTimingFunction. (to get a arbitrary curve)

ⅰ亾dé卋堺 提交于 2021-01-27 04:43:33
问题 I am using a CADisplayLink to do a view animation that just interpolates a value and redraws the view itself. e.g. I have a view MyView and it has a property value , whenever value is set I call setNeedsDisplay and the view knows what to draw. to animate this I use CADisplayLink and I want the view to 'morph' between values. I do this by just interpolating the value from the animation's start and stop Value: - (CGFloat)interpolatedValue:(CGFloat)sourceValue withValue:(CGFloat)targetValue