core-animation

How to specify an beginTime for an animation by using CFTimeInterval?

ぐ巨炮叔叔 提交于 2019-12-02 16:17:15
For my understanding, beginTime can be used to say "hey, start at exactly 12:00 'o clock". But how would I tell this with an CFTimeInterval type? I thought that this one is nothing more than a kind of "float" value to specify seconds. Or what else would be then the difference to the timeOffset property that is specified in CAMediaTiming protocol? What I missed in the docs: beginTime is in "core animation absolute time" so you've to get the current time and specify your offset from that: // Start in 5 seconds theAnimation.beginTime = CACurrentMediaTime()+5; Chris You first need to convert to

What does “Receiver type 'CALayer' for instance message is a forward declaration” mean here?

你离开我真会死。 提交于 2019-12-02 16:02:04
I'm porting a block of code from an iOS4 project to iOS5 and I'm having some troubles with ARC. The code generates a PDF from a screen capture. PDF Generation Code UIView *captureView; ... NSMutableData *pdfData = [NSMutableData data]; UIGraphicsBeginPDFContextToData(pdfData, captureView.bounds, nil); UIGraphicsBeginPDFPage(); CGContextRef pdfContext = UIGraphicsGetCurrentContext(); [captureView.layer renderInContext:pdfContext]; UIGraphicsEndPDFContext(); The renderInContext line [captureView.layer renderInContext:pdfContext]; generates the following error. Automatic Reference Counting issue

adding bounce effect to appearance of UIImageView

余生颓废 提交于 2019-12-02 15:59:24
How can I add a bounce effect when I am about to show an UIImageView as a subview? Do I have to use CoreAnimation to do this? My only guess right now is to use CAKeyframeAnimation, please let me know if there's a better way. Here's my current code: CABasicAnimation * theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"]; theAnimation.delegate = self; theAnimation.duration = 1.0; theAnimation.fromValue = [NSNumber numberWithFloat:notif.center.y]; theAnimation.toValue = [NSNumber numberWithFloat:notif.center.y-20]; theAnimation.repeatCount = 3; y-axis animation using

NSImageView is hoping when from the location when trying to rotate. How to stop it?

若如初见. 提交于 2019-12-02 15:14:57
问题 I am rotating an NSImageView from its center which is working perfectly however when I start the animation the NSImageView hops from its location to a random location. I do not know why is it happening. Please help. I am elaborating how I am doing it all. Also, I am providing a Github link so that you may run it if you want. github project link Code: // on button press animation will be started -(void)buttonPressed:(id)sender{ // setting the anchor point of the view _img.layer.anchorPoint =

How do you make images wobble like on the iPhone home screen?

孤人 提交于 2019-12-02 14:58:37
I have many icons in my app and I would like to animate them in a manner similar to what happens when you try to delete applications from the iPhone's home screen. How can you do this? Additionally, is there a way to have the icons animate up onto the screen in a manner similar to what happens when you unlock the iPhone? If you want to make your views, images, etc. wobble, like the home screen, you could do something like this: CGAffineTransform leftWobble = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-15.0)); CGAffineTransform rightWobble = CGAffineTransformRotate

Are there any third-party libraries to do cool view transitions in iPhone OS?

允我心安 提交于 2019-12-02 14:45:45
I don't really like that flip-transition. It's boring. I'd like to see something cool, like water effect, fog, or whatever. Is there something available or do I have to (re)invent the wheel for that? The animation types available via [CATransition animation] are: kCATransitionFade kCATransitionPush kCATransitionMoveIn kCATransitionReveal @"suckEffect" @"spewEffect" @"genieEffect" @"unGenieEffect" @"rippleEffect" @"twist" @"tubey" @"swirl" @"charminUltra" @"zoomyIn" @"zoomyOut" The transition types available via [UIView setAnimationTransition:forView:cache:] are:

How to animate a human written stroke using Swift/iOS?

我与影子孤独终老i 提交于 2019-12-02 14:18:00
Objective I am attempting to create an animated approximation of human writing, using a UIBezierPath generated from a glyph. I understand and I have read the many UIBezierPath questions which sound similar to mine (but are not the same). My goal is to create an animation that approximates the look of a human performing the writing of characters and letters. Background I've created a playground that I am using to better understand paths for use in animating glyphs as if they were drawn by hand. A couple of concepts in the Apple CAShapeLayer (strokeStart and strokeEnd) really don't seem to

How to get text in a CATextLayer to be clear

六眼飞鱼酱① 提交于 2019-12-02 13:53:38
I've made a CALayer with an added CATextLayer and the text comes out blurry. In the docs, they talk about "sub-pixel antialiasing", but that doesn't mean much to me. Anyone have a code snippet that makes a CATextLayer with a bit of text that is clear? Here's the text from Apple's documentation: Note: CATextLayer disables sub-pixel antialiasing when rendering text. Text can only be drawn using sub-pixel antialiasing when it is composited into an existing opaque background at the same time that it's rasterized. There is no way to draw subpixel-antialiased text by itself, whether into an image or

Animated pie chart that can animate in both directions

馋奶兔 提交于 2019-12-02 13:31:29
I am trying to build an animated pie chart that can animate the pie in both directions depending on whether the value of its progress increases or decreases. I've started with sample code provided here and made some adjustments as suggested here . The trouble is that the back-animation is not yet quite working. It only partially clears the pie. I am not quite sure whether this is due to me using animations incorrectly or calculating coordinates incorrectly, for if I insert CGContextSetFillColorWithColor(context, UIColor.redColor.CGColor); into the first if branch and change blend mode to

If statement on NSNotificationCenter in iOS

这一生的挚爱 提交于 2019-12-02 11:45:33
I'm trying start another animation when one ends. I am checking for callbacks like this: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(animationDidStopNotification:) name:ImageAnimatorDidStopNotification object:animatorViewController]; How do I make an if statement that lets me do trigger something when ImageAnimatorDidStopNotification is received? Thanks! You didn't post enough code to know what are you trying to do and where is the problem. If you want to chain two (or more) animations with UIKit, try using setAnimationDidStopSelector: selector. - (void