Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8058335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:19:24+00:00 2026-06-05T09:19:24+00:00

Hello I am new to animations and just started playing around with it recently.

  • 0

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];*/

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:19:25+00:00Added an answer on June 5, 2026 at 9:19 am

    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:

    -(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.image = [UIImage imageNamed:@"largeRing.png"];
    [self.view addSubview:imageView];
    
    [self animate:imageView enlarge:YES];
    }
    
    -(void) animate:(UIImageView*)imageView enlarge:(BOOL)flag
    {
    if (flag) 
    {
    // then animating is starting
    // and imageView will appear in random point of view
        int randomX = arc4random()%self.view.frame.size.width;
        int randomY = arc4random()%self.view.frame.size.height;
        imageView.center = CGPointMake(randomX, randomY);
    }
    
    double scale = flag ? 2 : 0.5;
    [UIView animateWithDuration:5
             animations:^{ imageView.transform = CGAffineTransformMakeScale(scale,scale); }
             completion:^(BOOL finished){ [self animate:imageView: enlarge:!flag]; }];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to using JQuery and was just playing around. I'm trying to
hello im new to python and have been reading over the documentation and am
Hello.Am new to ios development.What have to do for NSOpenPanel to work in the
I have the following (pseudo) code root = _iface.createRoot(...) Label l = new Label(hello
Hello iam new to GWT framework. I want to persist my domain objects/entities to
I have a C# .Net 3.5 application that sends a multicast Hello packet to
Hello I`m new with C# and I want to make a simple C# pin
i just recently asked a question and got help but i have another problem
Hello I am new to WPF and i do have some experience in ASP.NET
I make a alternate entry point that display a dialog Hello new week on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.