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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:28:43+00:00 2026-05-24T22:28:43+00:00

At first: I’m using cocos2d for iphone. But this isn’t so important for this

  • 0

At first:
I’m using cocos2d for iphone. But this isn’t so important for this question.

My problem is now…I want to scale a sprite on the Y axis. I can do that with this function:

mySprite.scaleY = myFloatValue;

I want to set the scaleY value related to the rotation of the sprite..

Some cases:

If the rotation is 0, scaleY is 0.
If the rotation is 90, scaleY is 1.
If the rotation is 180 scaleY is 0
If the rotation is 360 scaleY is 0.
If the rotation is 45 scaleY is 0.5.

Some more explanation:
If my sprite is vertical the scaleY value is 1.
If my sprite is horizontal the scaleY value is 0.

And I need a forumula for this.

I got it working for the angles between 0 and 90:

mySprite.scaleY = rotation/90.0f;

From the angles between 90 and 180 teh scaleY should go from 1.0 to 0.0f

I want to make a smooth scaling..

Btw, did you understood what I want? If not I could make a video or some screenshots..

  • 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-24T22:28:44+00:00Added an answer on May 24, 2026 at 10:28 pm

    How about mySprite.scaleY = sinf(rotation);

    EDIT:

    To make it always positive

    mySprite.scaleY = fabs(sinf(rotation));
    

    Where rotation is in radians

    mySprite.scaleY = fabs(sinf(M_PI * rotation / 180));
    

    Where rotation is in degrees

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

Sidebar

Related Questions

First post, but I've been lurking around this site for a long while now,
First of all, I know I asked a similar question before but this one
First let me say that I really feel directionless on this question. I am
First question on SOF, please be gentle if this may be a stupid question.
First let me preface this question by saying that I'm fairly new to Javascript.
First of all, i would like to explain my condition right now. I'm using
First of all, I am sorry if this question doesn't belong to SO since
First, let's get the security considerations out of the way. I'm using simple authentication
First off, I am using Windows XP. I have multiple hard drives and it
First of all, I know how to build a Java application. But I have

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.