Tag: animation

How to scale UIImageView properly with UIView animateWithDuration?

I’m scaling UIImageView and then reverting it using UIView animateWithDuration with UIViewAnimationOptionAutoreverse option. The problem is the image animation is a little bit jaggy (twitching) at the end of the animation. Here’s my code: [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionAutoreverse animations:^{ myImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);} completion:^(BOOL finished){if (finished){ myImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);}}]; I know that […]

iphone development: how to create an animation by using NSTimer

In my app I have this code in viewWillAppear. It simply animates random object from top of the screen to the bottom. The problem is I need to detect collision and what I have learnt so far is it is impossible to retrieve the coordinates at any time for an animation. so how can I […]

How to animate multiple SKSpriteNode together?

I am pretty new to SpriteKit. I have a set of nodes that need to move together to a different point for each node and after that animation completed for all of them I would like to do something else. I was making this with UIView components before. A [UIView animateWithDuration:completion:] block was providing the […]

Stop Repeating UIView Animation Block?

I have a UIView animation block which uses the UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoReverse option so it keeps going, but at some points I need to stop the animation but more importantly stop it and have the view return to its original position. I have tried [dot1.layer removeAllAnimations]; but that stops it in its tracks without returning […]

How to get a item's coordinates while it is animating?

I can animate something across the screen like so: aView.frame = CGRectMake(100,100,50,50); [UIView animateWithDuration:25.0 delay:0.0 options:UIViewAnimationCurveLinear animations: ^{ aView.frame = CGRectMake(200,100,50,50); } completion:^(BOOL finished) { aView.hidden = YES; } ]; ..but how do I get the position of the item while it is animating? If I put a button on the screen and use this […]

Spritekit Joystick

I’m trying to execute some animations of my player sprite whenever I change the direction of the joystick. I’m using TheSneakyNarwhal’s drop in Joystick class which uses the following methods: if (joystick.velocity.x > 0) { [self walkRightAnim]; } else if (joystick.x < 0) { [self walkLeftAnim]; } if (joystick.velocity.y > 0) { [self walkUpAnim]; } […]

UIImageView animations lag at first run

I have a series of images that play in my application (it’s only got one view/viewcontroller). Whenever I run the app, the first time I play an animation, it will lag a bit the first time the animation is told to play. I run my animations via different methods (e.g. “animateJump”) which are responsible for […]

layoutAttributesForSupplementaryViewOfKind:atIndexPath: passes in incorrect indexPath

I have a customUICollectionViewLayout that uses supplementary views to place a footer at the bottom of each page. This seems to have been working well until I began to insert cells at the bottom of a page. As the supplementary views have to link to an NSIndexPath within the UICollectionView, in my prepare layout method […]

Thoughts on workflow of non-scripted animated scenes

I’ve been asked to look into developing a children’s book adaptation for iPad, the likes of which there are many on the App Store. It sounds like a really nice project, but my previous iOS projects have been of a more ‘static’ kind, drawing views, scrolling, zooming, tables, etc. and I’m having trouble coming up […]

Animating UIButton background image

Is there a way to animate a UIButton background image view with a set of images? I’ve managed to do so with the imageView property, but couldn’t find an equivalent background property. 10x