Hello I am new to animations and just started playing around with it recently. I want to have a circle (ring) displayed that goes from a small ring to a large ring, dissapears and then does the process all over again except in a different location.
To do this I have created 6 different image sizes of the same ring. The following code is how I have done it but I do not know how to repeat the process (AkA it runs the method but the location of the ring stays the same, I need to loop the random number generator but don’t know when to do a check if the image has stopped). If this is not the right way to go about this, please let me know! P.S. The ring looks very ugly by the time it gets to its largest stage, not sure why.
Thanks
-(void) doWork
{
NSInteger number;
NSInteger number2;
NSLog (@"here");
number = (arc4random()%100)+1;
number2 = (arc4random()%100)+1;
NSLog (@" hello numer1: %d", number);
NSLog (@" hello numer2: %d", number2);
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(number, number2, 135, 135)];
imageView.animationImages= [NSArray arrayWithObjects:
[UIImage imageNamed:@"smallestRing.png"],
[UIImage imageNamed:@"smallRing.png"],
[UIImage imageNamed:@"mediumRing.png"],
[UIImage imageNamed:@"large2Ring.png"],
[UIImage imageNamed:@"largeRing.png"], nil];
imageView.animationDuration= 2.5;
imageView.animationRepeatCount= 0;
imageView.contentMode = UIViewContentModeScaleAspectFit;
[imageView startAnimating];
[self.view addSubview:imageView];
/*[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(doWork) userInfo:nil repeats:YES];*/
}
if resizing (or other transforming such as rotation or transition) is the only animation you need, you could use method +animateWithDuration (you can found description here)
it will look like: