core-animation

Flip View Animation Not Working

血红的双手。 提交于 2019-12-22 18:36:24
问题 I am working on an iPad app that presents a question to the user in a view. When they answer the question, I would like the view to transition to another view that contains the next question. To make it look all fancy, I am trying to add a curl transition to it but the code I wrote does not work can I can't see to find the problem. It does show the correct view but there is no transition animation. What's with that? Here is the method I use to transition: - (void)pageChangedTo:(NSInteger)page

How would I make an explosion animation on iOS?

我只是一个虾纸丫 提交于 2019-12-22 10:57:33
问题 I have an iOS game, and when a ball hits a target it explodes. What would be the best way to animate this explosion? 回答1: If you're looking for something simple. Make a series of images that animate the explosion. Add those to a UIImageView and start the animation. Something like this: UIImage *image0 = [UIImage imageNamed:@"explosion0.png"]; UIImage *image1 = [UIImage imageNamed:@"explosion1.png"]; UIImage *image2 = [UIImage imageNamed:@"explosion2.png"]; UIImage *image3 = [UIImage

CATextLayer subpixel antialiasing

拥有回忆 提交于 2019-12-22 09:48:07
问题 My app draws layer-backed labels over a NSImageView . The image view displays an image, and a tint color over that image. This ensures that the contrast between the labels and the background image works. As you can see, subpixel antialiasing is enabled and works correctly. When you hover over those labels, they animate the frame property (Actually the view containing them). While animating, the subpixel antialiasing is disabled, and when done enabled again. This looks incredibly weird. The

CAShapeLayer path disappears after animation - need it to stay in the same place

戏子无情 提交于 2019-12-22 08:11:26
问题 Thanks to some help on StackOverflow, I am currently animating a path in CAShapeLayer to make a triangle that points from a moving sprite to another moving point on the screen. Once the animation completes, the triangle disappears from the screen. I am using very short durations because this code is being fired every .1 of second for each of the sprites. The result is the red triangle tracks correctly, but it rapidly flashes or isn't there entirely. When I crank up the the duration, I can the

When is it appropriate to use Core Animation over UIView animation in common cases

ε祈祈猫儿з 提交于 2019-12-22 07:58:08
问题 This is related to a lot of little bugs that might stereotypically be considered minor by one person, but major by another. What I've noticed more and more, is that when using all flavors a UIView animateWithDuration: , it actually modifies things unnecessarily, such multiple properties of my views', to do a simple hide/reveal style animations, etc.. Things seem to be finicky in scenarios like a UINavigationBar not animating into position properly for a certain rotation transition, or a

setAnimationRepeatAutoreverses not behaved as I expected

丶灬走出姿态 提交于 2019-12-22 07:23:14
问题 I am starting to learn to use UIView animation. So I wrote the following lines: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [UIView setAnimationRepeatCount:2]; [UIView setAnimationRepeatAutoreverses:YES]; CGPoint position = greenView.center; position.y = position.y + 100.0f; position.x = position.x + 100.0f; greenView.center = position; [UIView commitAnimations]; In this case, the UIView (a green box) moved back and fore 2 times. So far so good, BUT I found

Moving an image along a series of CGPoints

狂风中的少年 提交于 2019-12-22 05:54:54
问题 I have path stored in an array of CGPoints which I'd like to move an image along. Here's the general code I have so far: -(void)movePic:(id)sender{ for(int i = 0; i < self.array.count; i++){ CGPoint location = [[self.array objectAtIndex:i] CGPointValue]; [UIView animateWithDuration:0.1 animations:^{ self.imageView.center = location; } completion:^(BOOL finished){ }]; } } The problem is the for loop runs extremely fast, so you only see the animation on the last points. I'm unsure of how to

Bizarre unwanted animation occurring in iPhone app

删除回忆录丶 提交于 2019-12-22 05:33:10
问题 I hate to post this but I am seeing unwanted animation in an iPhone app that I am working on. I have never seen this before in my apps or any other apps. This app is for iOS 4.2 and for iPhones only. The weirdness is happening even on an iPhone4. Examples: When the application in question launches a UIAlertView , it "flies in from the top or top left." When any UITableView scrolls, the new (standard) cell data "expands in from the left of the cell" when first coming into view and thus

Layer Position jumps at start of (Core) Animation

安稳与你 提交于 2019-12-22 05:27:27
问题 So, I'm trying to create a tile flipping effect, like on Windows Phone 7. So far I have the following code, but I have a couple of queries. CALayer *layer = self.theRedSquare.layer; CATransform3D initialTransform = self.theRedSquare.layer.transform; initialTransform.m34 = 1.0 / -1000; [UIView beginAnimations:@"Scale" context:nil]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; layer.transform = initialTransform; layer.anchorPoint = CGPointMake(-0.3

Animate drawing arc with UIBezierPath

隐身守侯 提交于 2019-12-22 04:42:17
问题 I have drawn an arc using: - (void)drawRect:(CGRect)rect { UIBezierPath *stripePath = [UIBezierPath bezierPath]; [arcColor set]; [stripePath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:clockwise]; stripePath.lineWidth = arcWidth; stripePath.lineCapStyle = kCGLineCapRound; stripePath.lineJoinStyle = kCGLineCapRound; [stripePath stroke]; } Now I want to animate this arc by the angle. I am trying it with something like: angle = startAngle; [UIView