Chandaboy
Chandaboy

Reputation: 313

Increase the width of a sprite through an animation

I'd like to know how to increase the width of a sprite through an animation.

    CCSprite *waterImage = [CCSprite spriteWithFile:@"water.png"];
waterImage.position = ccp(10,20);
waterImage.scaleY = 1.0;//6.5;
[self addChild:waterImage];

I want to scale the image of the sprite on the Y axis through an animation. Please, if you have any tutorials, then share them with me.

Upvotes: 0

Views: 152

Answers (1)

Tayyab
Tayyab

Reputation: 10631

You can use runAction to animate the scaling of your image like this,

[waterImage runAction:[CCScaleTo actionWithDuration:5 scaleX:6.5 scaleY:1]];

Provide "scaleY:1" so that image only scale on x-axis.

Hope it helps

Upvotes: 3

Related Questions