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 6538699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:45:59+00:00 2026-05-25T10:45:59+00:00

I have a mask that I’ve build thanks to a layer and an image.

  • 0

I have a mask that I’ve build thanks to a layer and an image. I want to move this layer with little “jumps” (without a nice translation animation).

The problem is that there is an animation happening whenever I move the frame of the mask layer. I’ve tried calling [maskLayer removeAllAnimations]; but it doesn’t change anything.

In my code, I don’t put any animation at all, so I don’t understand where this animation comes from.

When I launch this function :

-(void) moveAlternativeMask:(CALayer*) maskLayer {
     NSLog (@"moveAlternativeMask %@", NSStringFromCGRect(maskLayer.frame));

    // Change the frame of the layer
    CGRect originalFrame = maskLayer.frame;
    CGFloat newYPos = maskLayer.frame.origin.y + 5.;
    maskLayer.frame = CGRectMake (originalFrame.origin.x, newYPos, originalFrame.size.width, originalFrame.size.height);

    // Try removing all animations on the layer
    NSLog (@"Animations");
    for (NSString* animationKey in maskLayer.animationKeys) {
        NSLog(@"    Animation With Key %@", animationKey);
    }
    NSLog (@"End animations");
    [maskLayer removeAllAnimations];

    NSLog (@"Animations after removing");
    for (NSString* animationKey in maskLayer.animationKeys) {
        NSLog(@"    Animation With Key %@", animationKey);
    }
    NSLog (@"End animations after removing");

    // Launch the animation with a small delay
    [self performSelector:@selector(moveAlternativeMask:) withObject:maskLayer afterDelay:0.5];

}

I get this log :

—-moveAlternativeMask {{0, 200}, {768, 643}} —-
Animations
Animation with key : position
End animations
Animations after removing
End animations after removing

—moveAlternativeMask {{0, 205}, {768, 643}}
Animations
Animation with key : position
End animations
Animations after removing
End animations after removing

—moveAlternativeMask {{0, 210}, {768, 643}}
Animations
Animation with key : position
End animations
Animations after removing
End animations after removing

So the layer is moved as I want, the only problem is that the “position” animation keep coming back…

Note that the CALayer was build like this :

UIImage *maskImage = [UIImage imageNamed:@"masque2.png"];
self.maskLayer = [CALayer layer];
self.maskLayer.contents = (id) maskImage.CGImage;
self.maskLayer.frame = CGRectMake(0, ORIGINAL_Y_POSITION, 768, 643);
[myView.layer setMask:self.maskLayer];
  • 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-25T10:45:59+00:00Added an answer on May 25, 2026 at 10:45 am

    Hmm, very strange. I have 2 ideas:

    1. Is it feasible to try doing this with a UIView instead?
    2. Could you perhaps try removeFromSuperview and addSubview instead of just changing the frame?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one mask image, this image is transparent and I will change the
I have <div class=image-mask> <img class=alignright src=image.png /> </div> and I would like to
i have a DevExpress Grid and want to set up an edit Mask on
I have an XML file looks like this: <?xml version=1.0 encoding=utf-8 ?> <PathMasks> <Mask
have written this little class, which generates a UUID every time an object of
I have a string on which I try to create a regex mask that
I want to generate a binary mask that has ones for all voxels inside
We have an application that can mask numbers on nearly any application, win32, browser,
I have two textures: background and mask. I need to make output that mask
I have a problem that I'd like to add round mask on top of

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.