FAQ Database Discussion Community


How to create Custom flip animation using UIView

ios,objective-c,animation,uiview,core-animation
I am trying to create a custom animation something like the default flip animation for a UIView, but without the actual flip, and also the axis of the flip I want to be on the left side not on the center. Here is an example of what I am trying...

How does CALayer geometryFlipped behave exactly?

ios,osx,core-graphics,core-animation,cgaffinetransform
Let's assume i have a CGPathRef called somePath and I'm doing this: CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; shapeLayer.path = somePath; shapeLayer.geometryFlipped = YES; But for some reason i don't want to flip the geometry – i'd want to do something like this: CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; CGAffineTransform...

Pause and resume animations except of rotation in iOS?

ios,animation,rotation,core-animation,calayer
If I need simply to pause/resume rotation then I use the following code: - (void)pauseAnimations { CFTimeInterval paused_time = [self.layer convertTime:CACurrentMediaTime() fromLayer:nil]; self.layer.speed = 0.0; self.layer.timeOffset = paused_time; } - (void)resumeAnimations { CFTimeInterval paused_time = [self.layer timeOffset]; self.layer.speed = 1.0f; self.layer.timeOffset = 0.0f; self.layer.beginTime = 0.0f; CFTimeInterval time_since_pause = [self.layer...

Core Animation: Unexpected Vertical Flipping on 3D Rotation 'Bounce'

ios,objective-c,animation,core-animation,calayer
I am trying to create a flip transition that contains a grid of CALayer cells that flip over and 'bounce' after they have done so. However, I am encountering a weird vertical flipping issue shown in this video. Without the 'bounce' animation at the end, the animation works as expected,...

rotate 180 degree for an UIImageView, and rotate back with same route

ios,core-animation
I got a button and want to rotate the image inside it: self.DashButton.imageView.transform = CGAffineTransformMakeRotation(M_PI); The image is a up-arrow to down-arrow after user click it When clicking the button again, I want the down-arrow rotate to up-arrow again, but it is the same counterclockwise rotation, but I just want...

Why does my CATextLayer not respond to the contentsGravity property?

objective-c,cocoa,core-animation,calayer,nsview
I am creating a Cocoa app with a layer-backed NSView. I have customised the layer backing the view to be of type CATextlayer because the primary purpose of this view is to display some text. I include the following line in my init procedure and it does not work for...

runAction in swift, make object follow a path

ios,xcode,swift,core-animation,uibezierpath
I'm trying to make an object follow a circular path every time I press a button, but it gives me an error in the last line that says UIImageView does not have a member named runAction. I already tried with .addAnimation but it still won't work. let path = CGPathCreateMutable()...

Core animation returns layer to the original position when label's text is changed

ios,objective-c,core-animation
I've got simple animation which moves my view's layer and remains in it's final state. CGPoint originalPosition = self.redSquare.layer.position; self.redSquare.layer.position = CGPointMake(100, 100); CABasicAnimation *animation = [[CABasicAnimation alloc]init]; animation.keyPath = @"position.x"; animation.fromValue = @(originalPosition.x); animation.toValue = @250; animation.duration = 2; [self.redSquare.layer addAnimation:animation forKey:@"basic"]; self.redSquare.layer.position = CGPointMake(250, originalPosition.y); But when I...

CAEmitterLayer emit continuously in a line

ios,objective-c,iphone,core-animation,particle-system
I am creating a very simple particle system with CoreAnimation. This is my cell: UIImage *image = [UIImage imageNamed:@"spark"]; CAEmitterCell *cell = [CAEmitterCell emitterCell]; [cell setContents:(id)image.CGImage]; [cell setBirthRate:250.f]; [cell setScale:.25f]; [cell setColor:[UIColor colorWithRed:1.0 green:0.2 blue:0.1 alpha:0.5].CGColor]; [cell setLifetime:5.0f]; and layer: CAEmitterLayer *emitterLayer = [CAEmitterLayer layer]; [emitterLayer setEmitterCells:@[cell]]; [emitterLayer setFrame:bounds]; [emitterLayer...

iOS Apply CATransform3D on every frame

ios,core-animation,avfoundation,calayer
I am capturing every frame of vide output and by processing it, I add a CALayer to an overlay which should be transformed according to the results from processing the frame. That CALayer basically knows how to draw an arrow. If I just add the CALayer on every frame it...

How to shrink a rectangular round cornered UIButton to a circular UIButton?

objective-c,iphone,uibutton,core-animation
With the help of this i was able to shrink the UIButton but atlast i want the UIButton to get rounded.Please help me to get the desired animation in sign up button. The code snippet is : Follow the link : https://www.dropbox.com/s/rh4tdub3zabxp2j/shot.gif?dl=0 self.buttonShrink = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; self.buttonShrink.duration = .2f; self.buttonShrink.values...

UITextView after CATransform3D: scrolling all out of whack

ios,objective-c,uitextview,core-animation,catransform3d
So I have a UITextView, and in viewDidLoad I rotate its layer so it appears to be slanted back into the screen (sort of like the Star Wars opening crawl). The problem is that scrolling is all messed up. Dragging up will scroll for a bit, then jump backward or...

CoreAnimation warning when updating NSProgressIndicator via a block executed on main queue

osx,cocoa,core-animation,nsoperationqueue,nsprogressindicator
I have the following scenario for exporting Core Data entities to JSON and displaying a progress bar while doing so. Sometimes, after the sheet with the progress bar is dismissed when the export is completed, i get the follwing warning as a console message: CoreAnimation: warning, deleted thread with uncommitted...

iOS Objective-C: Determine current 3D rotation of a UIView

ios,objective-c,core-animation,quartz-graphics
I am trying to determine the current 3D rotation of a UIView. I know that to get the 2D rotation is: CGFloat radians = atan2f(view.transform.b, view.transform.a); Not sure how to get the current 3D rotation. I want to be able to autoreverse the animation and preserve its starting point. The...

Glitch-style animations using Core Animation

ios,objective-c,core-animation
I'm looking to recreate some Glitch style animations I found in a video online: http://videohive.net/item/outcome-glitch-slideshow/7494021 I want to use Core Animations to animate UIViews on and off the screen in the glitchy style presented in the video. More specifically: I'm looking for a way to split up a single UIView...

Why not leave ' shouldRasterize' on?

core-animation
Why people usually switch the status of shouldRasterize instead of leave it on? I can assume this is relevant to resource consumption but can anybody explain me some detail or provide some relevant link? ...

CATransaction: a view flashes on completion

ios,uiview,core-animation,cabasicanimation,catransaction
I'm writing a little bit complex animation, which goes in 2 steps: Change opacity to 0 of UIViews that are not need to be visible and move a UIImageView (which has alpha = 1) to another CGPoint (position). Change opacity of another UIView to 1 and the opacity of the...

Karaoke-like progress highlight for iOS

ios,cocoa-touch,core-graphics,core-animation,core-text
I would like to implement karaoke-like progress highlight for iOS. I know I could use NSAttributedString and highlight the text character by character. However, I would like the highlight to progress pixel by pixel, not character by character. Any ideas? P.S. No need for sample code, just point me to...

Animation ends with error in custom interactive transitioning animation?

ios,core-animation,uiviewanimationtransition
I am setting up a custom transitioning animation. Everything works fine except the error at the end of the animation: As you see, after the interactive animation, the animation just excutes again. This is the method i use to handle the the interactive gesture in the class the conforms to...

UIView Slide Animation

ios,swift,uiview,core-animation
I am trying to create animation to swap/rotate the UIViews using UIPanGestureRecognizer. I have three UIViews and want to add animation to bring left or right view to the front on drag. If users drag the front view to right then the left view should come to the front with...

Animation Direction on iOS [closed]

ios,core-graphics,core-animation
I know everything about animation Tools in iOS. Rotation, Scaling and Moving but I have made a bad timing for example I have two Squares one on the Left and the Other on the Right and i want the two squares two rotates until they hit each other with Angle...

CITransform vs CATransforms which and when to use?

ios,core-graphics,core-animation,core-image
I need to draw an overlay over camera, which on every frame draws an arrow with a different direction. Now as I understand, because of processing every frame, I should be using the Core graphics drawing, but besides just drawing the arrow I need to give it a perspective effect...

CATransform3D making my UITextView disappear?

ios,objective-c,core-animation,catransform3d
So I have a UITextView that's supposed to be visually sitting on the bottom edge of the screen and then stretching up and back "into" the screen, "Star Wars" opening crawl-style. After much googling etc, I feel like I have what looks like the right code for the job... but...

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

ios,uiview,core-animation
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...

CAGroupAnimation does not show animations. Animations work fine when added separately

ios,swift,core-animation
I am implementing a simple activity indicator using Swift and Core Animation. The core animation loop consists of just two animations. When I add them to the layer directly, they work perfectly. When I add them as a CAAnimationGroup, nothing is happening at all. I am utterly confused by this...

Opening and closing form animation

ios,ios8,core-animation,ios-animations
Is this animation possible in iOS, any third party API's for that? ...

CABasicAnimation byValue strange behavior

ios,swift,core-animation
I was reading the 12th number of Objc.io and encountered a problem when trying the first pieces of code. In the first part "A Basic Animation" the last piece of code uses byValue to interpolate a property using initial property value and adding byValue. So I tried the code in...

how to implement a zoom in/out animation for UICollectionView

ios,objective-c,core-animation
I got a UICollectionView with several cells on the screen. I want to add one animation that can zoom out/in the cell; The logic behind is when clicking the cell, it will invoke [self.navigationController pushViewController:_chartViewController animated:NO]; I am not clear how to zoom in/out the new _chartViewController Looking for the...

Combining multiple CAAnimations in a CALayer hierarchy

ios,core-animation,calayer
I've got this rather simple piece of example code in which I have a simple hierarchy consisting of three layers; view layer |- base layer |- green layer Now I want to move the base layer and at the same time adjust the color of the green layer, so I've...

CAReplicatorLayer's instanceDelay ignored

objective-c,core-animation,careplicatorlayer
I'm trying to create multiple "cards" to animate them afterwards using this code: CAReplicatorLayer *cardsWrapperLayer = [CAReplicatorLayer layer]; cardsWrapperLayer.instanceCount = 4; cardsWrapperLayer.instanceDelay = 10; cardsWrapperLayer.instanceTransform = CATransform3DMakeTranslation(0, phoneSize.height + self.phonePadding, 0); [cardsWrapperLayer addSublayer:self.cardLayer]; but they are appearing all at the same time, even if the instanceDelay is set to 10....

NSScrollView: fade in a top-border like Messages.app

objective-c,cocoa,core-animation,calayer,nsscrollview
What I Want to Do: In Messages.app on OS 10.10, when you scroll the left-most pane (the list of conversations) upwards, a nice horizontal line fades in over about 0.5 seconds. When you scroll back down, the line fades back out. What I Have: I am trying to achieve this...

Launch Image Splash Screen Animation in SWIFT

ios,swift,animation,core-animation,splash-screen
I want to create a twitter like launch image for my ios app in swift. I do understand the general problem with animated launch images, and I basically know the steps to create such an animation: Add a new view, right after the app launched, with the exact same content...

How can I animate the size of UILabel or UITextField text?

ios,objective-c,uilabel,core-animation
I have a UITextfield in a UIView that contains some default text. I want to animate the scaling of this textField (along with the parent UIView) %300, and later back down to 100%. How do I do this? It seems everything I've found involves a hacky image capture and a...