core-animation

CABasicAnimation current elapsed time

房东的猫 提交于 2019-12-10 01:52:32
问题 I just rewrote quite a big animation from a dumb while loop (firing drawRect: x times) and this is the last thing that I just can't figure out.. How can I get the current elapsed time of my animation? I know how to get the current CFTimeInterval (Is there a way to pause a CABasicAnimation?): CFTimeInterval currentTime = [self.multiplierLayer convertTime:CACurrentMediaTime() fromLayer:nil]; But how can I use this to calculate the current elapsed time from the moment my animation started? It

How can I add Core Animation framework to my Xcode project?

给你一囗甜甜゛ 提交于 2019-12-10 01:10:22
问题 I just can't find that framework for adding it. Any ideas? 回答1: Add the QuartzCore framework. It contains CoreAnimation. 回答2: Also, make sure that you do an #import <QuartzCore/QuartzCore.h> before using any Core-Animation-specific classes, etc. 回答3: You need to add the QuartzCore framework to your project. 回答4: Click on your project in project navigator. Click on the target. Click on "build phases" tab. Expand "Link Binary with Libraries". Click "+" to add. 来源: https://stackoverflow.com

CATransaction Not Animating

ぐ巨炮叔叔 提交于 2019-12-09 22:38:24
问题 I've created a new View-based Application in XCode. In the ViewController, the only code that I've modified looks like this: - (void)viewDidLoad { [super viewDidLoad]; UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; newView.backgroundColor = [UIColor redColor]; [self.view addSubview:newView]; [CATransaction begin]; [CATransaction setValue:[NSNumber numberWithFloat:0.5f] forKey:kCATransactionAnimationDuration]; newView.layer.frame = CGRectMake(20,20,220,220);

CoreAnimation CALayer and CATextLayer combination

有些话、适合烂在心里 提交于 2019-12-09 18:29:53
问题 I'am just playing around with CA lately. Now I am kind of stuck. This is the thing I want to animate: As for now I already got the circle animation working. I subclassed CALayer to make the animation. I really don't know where to go from here. Where do I have to add the sublayer of CATextLayer? How do I animate both at the same time so it looks like the text with its line is sticking at the circle end? If you need some code or anything else let me know. I would be really happy to get some

How to call scrollViewDidScroll: the same way UIScrollView does, but during custom animation?

别来无恙 提交于 2019-12-09 17:59:04
问题 I have a very large horizontally scrolling UIScrollView which is reusing its subviews (moves and updates them when they are out of visible area, similar like UITableView is reusing cells). This relies on scrollViewDidScroll: delegate call, which gives me actual contentOffset, and here I decide when to reuse particular subview. So far so good. Sometimes I need to change contentOffset programatically, but with custom animation (inertia and bounce back to the final position). I can do this quite

Recommended objective-c Math libraries for working with Quaternions Matrices Vectors etc

不打扰是莪最后的温柔 提交于 2019-12-09 17:55:50
问题 I'm looking for a good Math library in objective-c that does your usual Matrix Vector and Quaternion tasks for use in conjunction with Core Animation. The library needs to be free for commercial use. Thanks! 回答1: Eigen is a lightweight C++ linear algebra package which provides could matrix, vector and quaternion support. While I have not used it in anger, it seems to have a much nicer interface than BLAS/LAPACK and supports a bunch of things those libraries don't 回答2: Current versions of iOS

Moving CALayer's mask on scroll in a Scrollview

醉酒当歌 提交于 2019-12-09 15:18:05
问题 I am experimenting with iOS SDK and I have the following UIView structure: UIView UIImageView - only a background image UIImageView (with a CALayer mask) UIScrollView Label Very simple structure, UIScrollView is transparent layer and second UIImageView has a mask on it. What I am trying to do is that CALayer mask would move it's position according to position of the Content in the scroll view. If user scrolls, mask's position should be updated. I already solved this problem by using

Change CAShapeLayer without Animation

ぐ巨炮叔叔 提交于 2019-12-09 14:46:15
问题 I want to set the strokeEnd property of a CAShapeLayer without the default animation, with no animation at all. I've looked around to try to find how to do this but everything seems to be about how to animate properties. 回答1: In Core Animations terminology, a more general term for an animation is an "action". You can for example see that the CAAnimation conforms to the CAAction protocol. You also see the terminology "action" used when disabling them (disabling the animations). There are many

Drag a UIView part-way, then it moves on its own

核能气质少年 提交于 2019-12-09 13:35:10
问题 I have an app with a draggable UIView placed at the bottom. The draggable view isnt totally offscreen and it has a "pull tab" that the user can drag upwards or downwards. Dragging up and down currently works, but I would like to give it the same behavior as the Apple notifications slide out drawer. For example, if I drag the view out 50% upwards and remove my finger from the screen, then I'd like the draggable view to continue to move upwards on its own. Likewise, if the user only dragged the

CABasicAnimation and custom types

我只是一个虾纸丫 提交于 2019-12-09 13:30:24
问题 I'm not very familiar with CoreAnimation, so I hope I've just missed something pretty simple. I want to animate a custom property ( NSGradient ) of a NSView in a simple manner, with [[view animator] setGradient:gradient]; . I defined + (id)defaultAnimationForKey:(NSString *)key and returned a simple CABasicAnimation, however, no animation is executed. Since this works for simpler types and NSColor, I guess CABasicAnimation doesn't work with gradients. Fine, but in this particular case