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

  • Home
  • SEARCH
  • 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 3405494
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:30:44+00:00 2026-05-18T05:30:44+00:00

I am trying to animate a wheel When the finger rests for > 0.1s,

  • 0

I am trying to animate a wheel

When the finger rests for > 0.1s, the wheel ‘ pops out ‘ ie I animate Scale from 1.0 to 1.2.

when the finger moves, the wheel rotates with it ( only if it is popped out ).

But I’m getting a problem: as soon as it starts to rotate, the scale reduces back to 1.0.

- (void) spin: (Direction) direction
{
 float thetaOld = thetaWheel;

 float k = (direction == AntiClockwise) ? -1 : 1;
 float t = 2 * M_PI * ( k / 12.0 );
 thetaWheel += t;

 CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath:@"transform"];

 anim.fromValue = [NSNumber numberWithDouble: thetaOld];
 anim.toValue = [NSNumber numberWithDouble: thetaWheel];

 anim.valueFunction = [CAValueFunction functionWithName: kCAValueFunctionRotateZ];

 anim.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut]; 

 anim.duration = 0.1f;
 anim.fillMode = kCAFillModeForwards;
 anim.removedOnCompletion = NO;

 [self.wheelLayer addAnimation: anim forKey:@"transform"];
}

- (void) popOut
{
 CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath:@"transform.scale"];

 anim.fromValue = [NSNumber numberWithDouble: 1.0];
 anim.toValue = [NSNumber numberWithDouble: 1.2];

 anim.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut]; 

 anim.duration = 0.25f;
 anim.fillMode = kCAFillModeForwards;
 anim.removedOnCompletion = NO;

 [self.wheelLayer addAnimation: anim forKey:@"transform.scale"];
}

// doesnt get used yet
- (void) popBack
{
 CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath:@"transform.scale"];

 anim.fromValue = [NSNumber numberWithDouble: 1.2];
 anim.toValue = [NSNumber numberWithDouble: 1.0];

 anim.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut]; 

 anim.duration = 0.1f;
 anim.fillMode = kCAFillModeForwards;
 anim.removedOnCompletion = NO;

 [self.wheelLayer addAnimation: anim forKey:@"transform.scale"];
}

The last routine is not getting used at this time! So I can’t see what is reducing the scale back to 1…

it looks like somehow the second animation is overwriting the first one…

how to do this properly?

  • 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-05-18T05:30:45+00:00Added an answer on May 18, 2026 at 5:30 am

    I guess (have not tested that) that layer transform applied in animation for ‘transform’ keyPath overrides transformation you applied in your scaling animation.

    For rotation try using animation with transform.rotation.z keypath instead (and you won’t need to set valueFunction in that case)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to animate sliding out one view from a window and simultaneous
Trying to animate background color on page load but it only works when I
I am trying to animate my #main div so that it fades out and
I'm trying to animate a list item the same way asmselect does but it
I'm trying to animate an image (used as background image but it doesn't really
I'm trying to animate only the y position of a background image. Code works
I'm trying to animate a custom UIButton but my code doesn't seems to work.
Im trying to animate one elment after another, but I have some troubles with
I am trying to animate a div tag from center. Initially I want the
I'm trying to animate a push out box to display a list of things

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.