cabasicanimation

How To Get A Perfect Position Of Rotating View?

百般思念 提交于 2020-01-05 10:12:32
问题 I am have one view and I am rotating that view using CABasicAnimation . Now my problem is that how I get a perfect position of that view while rotating. I have tried many type of codes but i can't got a perfect position during rotation of that view. CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; NSNumber *currentAngle = [CircleView.layer.presentationLayer valueForKeyPath:@"transform.rotation"]; rotationAnimation.fromValue = currentAngle;

CABasicAnimation in uitableviewcell doesn't seem to work

青春壹個敷衍的年華 提交于 2020-01-05 06:59:27
问题 I'm trying to make a label within a tableview cell change background color with a CABasicAnimation and it doesn't seem to be working - the cell background color remains solid with no animation. This code is in the cellForRowAtIndexPath method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MainCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; NSString *name = @"Hello"; UIColor *color

CALayer disappears after playing a CABasicAnimation backwards

◇◆丶佛笑我妖孽 提交于 2020-01-04 02:42:35
问题 I have a CALayer and I've added a CABasicAnimation to it like this: circle = CALayer() circle.frame = CGRect(x: 0, y: 0, width: 100, height: 100) circle.backgroundColor = UIColor.green().cgColor circle.cornerRadius = 50 circle.speed = 0 view.layer.addSublayer(circle) animation = CABasicAnimation(keyPath: "position") animation.duration = 1 animation.fromValue = NSValue(cgPoint: CGPoint(x: 50, y: 50)) animation.toValue = NSValue(cgPoint: CGPoint(x: view.bounds.width / 2, y: view.bounds.height /

CABasicAnimation creates empty default value copy of CALayer

谁说胖子不能爱 提交于 2020-01-03 00:58:46
问题 I have a custom CALayer that draws radial gradients. It works great except during animation. It seems that each iteration of CABasicAnimation creates a new copy of the CALayer subclass with empty, default values for the properties: In the screenshot above, you see that CABasicAnimation has created a new copy of the layer and is updating gradientOrigin but none of the other properties have come along for the ride. This has the result of not rendering anything during the animation. Here's a GIF

NSImage rotation in NSView is not working

情到浓时终转凉″ 提交于 2020-01-01 19:44:48
问题 I am trying to rotate an NSImage inside a NSView., First I will show you what I have done so far. Image : Header file #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface AppController : NSObject { CALayer *syncFirst; } @property (weak) IBOutlet NSView *nsview; - (IBAction)buttonClicked:(id)sender; - (CGImageRef) convertToCGImageFromNasImage:(NSImage *) image; @end Implementation file, only related methods - (void)awakeFromNib { NSImage *image = [NSImage imageNamed:@

Animate CALayer hide

守給你的承諾、 提交于 2020-01-01 10:53:13
问题 I'm trying to hide a CALayer after a few microseconds and I'm using CABasicAnimation to animate the hide. At the moment I'm trying to use [aLayer setHidden:YES]; CABasicAnimation * hideAnimation = [CABasicAnimation animationWithKeyPath:@"hidden"]; [hideAnimation setDuration:aDuration]; [hideAnimation setFromValue:[NSNumber numberWithBool:NO]]; [hideAnimation setToValue:[NSNumber numberWithBool:YES]]; [hideAnimation setBeginTime:0.09]; [hideAnimation setRemovedOnCompletion:NO]; [hideAnimation

Animate CALayer hide

我的梦境 提交于 2020-01-01 10:52:02
问题 I'm trying to hide a CALayer after a few microseconds and I'm using CABasicAnimation to animate the hide. At the moment I'm trying to use [aLayer setHidden:YES]; CABasicAnimation * hideAnimation = [CABasicAnimation animationWithKeyPath:@"hidden"]; [hideAnimation setDuration:aDuration]; [hideAnimation setFromValue:[NSNumber numberWithBool:NO]]; [hideAnimation setToValue:[NSNumber numberWithBool:YES]]; [hideAnimation setBeginTime:0.09]; [hideAnimation setRemovedOnCompletion:NO]; [hideAnimation

Change CALayer color while animating

血红的双手。 提交于 2020-01-01 07:11:06
问题 APPROACH 1 CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; [CATransaction begin]; { [CATransaction setAnimationDuration:15];//Dynamic Duration [CATransaction setCompletionBlock:^{ }]; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; animation.autoreverses = NO; animation.removedOnCompletion = NO; animation.fromValue = @0; animation.toValue = @1; animation.timeOffset = 0; animation.fillMode =

iOS animate/morph shape from circle to square

♀尐吖头ヾ 提交于 2019-12-28 05:41:27
问题 I try to change a circle into a square and vice versa and I am almost there. However it doesn't animates as expected. I would like all corners of a square to be animated/morphed at the same time but what I get is the following: I use CAShapeLayer and CABasicAnimation in order to animate shape property. Here is how I create the circle path: - (UIBezierPath *)circlePathWithCenter:(CGPoint)center radius:(CGFloat)radius { UIBezierPath *circlePath = [UIBezierPath bezierPath]; [circlePath

Expand in place animation in CAShapeLayer

烂漫一生 提交于 2019-12-25 09:04:21
问题 I'm trying hard to animate a CAShape Layer but couldn't get it right.I have a layer. In a UIView subclass i create CALayer as follows - CAShapeLayer *shape1 = [CAShapeLayer layer]; shape1.fillColor = [[UIColor clearColor] CGColor]; shape1.strokeColor = [[UIColor purpleColor] CGColor]; CGRect frame1 = CGRectMake(13, 13, self.bounds.size.width - 26, self.bounds.size.height - 26); shape1.frame = frame1; shape1.position = CGPointMake(0,0); shape1.anchorPoint = CGPointMake(self.tableContainerView