开发者

How can we set time delay in animation of images to make them appear smooth?

开发者 https://www.devze.com 2022-12-30 10:48 出处:网络
I have 10 CCSprite images. They are continues images. I am using, CCSprite *playerH = [CCSprite spriteWithFile:@\"Player_01.png\" ];

I have 10 CCSprite images. They are continues images. I am using,

  CCSprite *playerH = [CCSprite spriteWithFile:@"Player_01.png" ];
  playerH.position = ccp(playerH.contentSize.width/2, windowSize.height/2);
  [self addChild:playerH z:1];
CCAnimation* animation = [CCAnimation开发者_JAVA百科 animationWithName:@"dance" delay:0.20f];
for( int i = 1; i < 11; i++ )
  {
        [animation addFrameWithFilename: [NSString stringWithFormat:@"Player_%02d.png", i]];

 }
 NSLog(@"k VALUE: k: %d",k);
 id actionA = [CCAnimate actionWithAnimation: animation restoreOriginalFrame:NO];
 id actionD = [CCDelayTime actionWithDuration:5.0f];
 id actionC = [CCCallFunc actionWithTarget:self selector:@selector(enemyEntranceScreen:)];
 id seqActionPlayer = [CCSequence actions:actionA, actionD, actionC, nil];

[playerH runAction: seqActionPlayer];  

But the animation is not continues. I have changed the animation delay time. but, I can see only three images appearing. How can we know how much time interval should we keep in animation.

Is there any relationship between this and the frame rate

[[CCDirector sharedDirector] setAnimationInterval:1.0/60];
[[CCDirector sharedDirector] setDisplayFPS:YES];  

Thank you.


I got my animation smoothly. I think it depends on the

[[CCDirector sharedDirector] setAnimationInterval:1.0/60];
[[CCDirector sharedDirector] setDisplayFPS:YES]; 

Previously the setAnimationInterval value is 60.0/60. I changed it to 1.0/60. I could find all the images when the value is 1.0/60. I adjusted the animation time delay between the images.
But, when setAnimationInterval is 60.0/60 even I set the value of animation delay to 1second, I could not see all the 10 images displayed.
But, I need some clarification on the setAnimationInterval:
Thank You.

0

精彩评论

暂无评论...
验证码 换一张
取 消