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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:48:18+00:00 2026-06-12T02:48:18+00:00

I have a CCLayer , that should be unmasked from top to bottom. I

  • 0

I have a CCLayer, that should be “unmasked” from top to bottom.

I implemented GLScissor pre-visit and post-visit to cut what is out of the layer bounds:

#pragma mark Clipping
-(void)visit {
    [self preVisit];
    [super visit];
    [self postVisit];
}
-(void)preVisit {
    if (!self.visible)
        return;

    glEnable(GL_SCISSOR_TEST);
    CGRect clipRect = [self boundingBox];
    CGPoint origin = [self convertToWorldSpaceAR:clipRect.origin];
    CGRect scissorRect = CGRectMake(origin.x - self.anchorPoint.x * clipRect.size.width, 768 - origin.y - self.anchorPoint.y * clipRect.size.height, clipRect.size.width, clipRect.size.height);

    scissorRect = CC_RECT_POINTS_TO_PIXELS(scissorRect);

    glScissor((GLint) scissorRect.origin.x, (GLint) scissorRect.origin.y,
          (GLint) scissorRect.size.width, (GLint) scissorRect.size.height);
}
-(void)postVisit {
    glDisable(GL_SCISSOR_TEST);
}

And I make the CCLayer grow by setting a contentSize of 1024×0 and using a scheduled call:

-(void) grow {
    float height = [self contentSize].height + 2;
    if (height >= 768){
        [self unschedule:@selector(grow)];
        height = 768;
    }
    [self setContentSize:CGSizeMake(1024, height)];
}

This works like a charm. The CCLayer grows in height steadily and it is unmasked perfectly. However, I can’t use any of the easing functions since I’m not using any action.

Is there any action that resizes the CCLayer (not scaling) that would allow me to use easing functions or is there any other (better) way to do this?

  • 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-12T02:48:20+00:00Added an answer on June 12, 2026 at 2:48 am

    The best candidate is to use CCActionTween (formerly: CCPropertyAction) and wrap that in an ease action:

    id tween = [CCActionTween actionWithDuration:5 key:"sizeHeight" from:1024 to:0];
    id ease = [CCEaseInOut actionWithAction:tween];
    [layer runAction:ease];
    

    This will modify the property named sizeHeight of the layer. You can use that to adjust the contentSize, since you can’t tween a C struct property like CGSize or CGPoint directly:

    -(void) setSizeHeight:(float)height
    {
        self.contentSize = CGSizeMake(self.contentSize.width, height);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little app up that has both CCLayer view and UIView. That
I have a UIScrollView which contains any number of thumbnails that should detect the
I have a scene created like that: MyScene (subclass of CClayer) .m +(CCScene *)
I have a CCLayer class where I create an animated sprite that is the
I have touches ended implemented for a CCLayer in cocos2D. When a touch is
I have a CCLayer which I need to add a camera to, on top
I have a CCMenu with CCMenuItems that I add on a CCLayer . When
I have this function return [remoteObject objectForKey:key]; which should return an object that is
I have an app with CALayers that move from one side of the screen
I have a CCSprite called sprite that is a child of a CCLayer called

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.