• Runtimes
  • Cocos2d 3.0 iPhone Color Change Animation

Related Discussions
...

Hi,

i have a color change key in my spine animation - which works fine in the gif-export.
But when exported as a json-animation and loaded into cocos2d the color does not change as expected.

Does the cocos2d iphone runtime support color changes?

  
_animatedDrop = [SkeletonAnimation skeletonWithFile:@"shrink_black_hole_drop.json" atlasFile:@"shrink_black_hole_drop.atlas" scale:0.5]; [_animatedDrop setPosition:CGPointMake(0.5, 0.5)]; [_animatedDrop setPositionType:CCPositionTypeNormalized]; [self addChild:_animatedDrop z:1]; [_animatedDrop setAnimationForTrack:0 name:@"button_click_slot_added" loop:NO];

What happens instead? Note button_click_slots_empty changes the attachment and this change will stay since button_click_slot_added does not change the attachment.

un mois plus tard

I am also seeing this. I am running a colour change and it does not change the colour - instead the colour remains unchanged.

I created an "eyes pulsing red" animation in Spine, and exported it into my Cocos2D 3.x project and get no eyes pulsing. Instead they remain with the base colour.

Other animations like "walk" are working fine.

After the code in SkeletonRenderer.m:

color.r = _skeleton->r * slot->r * r * multiplier;
color.g = _skeleton->g * slot->g * g * multiplier;
color.b = _skeleton->b * slot->b * b * multiplier;

If I add

if (strcmp(slot->data->name, "Alien_eyeballs") == 0)
{
    NSLog(@"Color: %u/%u/%u", color.r, color.g, color.b);
}

into I see lines like:

2014-10-01 13:55:56.480 SpaceBotAlpha[223:9872] Color: 239/113/114
...
2014-10-01 13:55:56.835 SpaceBotAlpha[223:9872] Color: 250/31/34

indicating that the numerical values are smoothly changing but this is not affecting the appearance of the sprite.

UPDATE:

There is a slight flicker when the animation cycles. It looks as tho it is being tinted for one frame.

Minimal example:
https://www.dropbox.com/s/96jehuqa5s8sr ... s.zip?dl=0
https://www.dropbox.com/s/4ey8d1j1r9amg ... r.zip?dl=0
https://github.com/sarah-j-smith/test_spine_color

This is with the very latest runtimes from git, and latest version of the editor.

Thanks for the info. It's easiest to see if you change SpineboyExample to use the "test" animation, which tints the gun and feet. Fixed in Git! 🙂

Thanks @Nate, that fixed it. Thanks for the quick response!