inline void create_key_frame_animation(const MistString& type, void* prop, const ConfigParserPtr& parser, StoryBoard* storyboard) { if(type == L"int") { SharedPtr<KeyFrameAnimation<int> > anim = MakeSharedPtr<KeyFrameAnimation<int> >(); int32 time = parser->getInt(L"time", 0); int32 duration = parser->getInt(L"duration", 0); if(duration == 0) return; anim->setDuration(duration); if(parser->toFirstChild()) { do { if(parser->hasAttribute(L"val")) { int32 val = parser->getInt(L"val", 0); int32 dur = parser->getInt(L"duration", 0); int32 type = parser->getInt(L"type", 0); anim->getKeyFrames().push_back(KeyFrameAnimation<int>::KeyFrame(val, dur, type == 0 ? KFT_Linear : KFT_Discrete)); } } while(parser->toNextChild()); storyboard->children().push_back(StoryBoard::AnimationInfo(time, anim, prop)); } return; } if(type == L"float") { SharedPtr<KeyFrameAnimation<float> > anim = MakeSharedPtr<KeyFrameAnimation<float> >(); int32 time = parser->getInt(L"time", 0); int32 duration = parser->getInt(L"duration", 0); if(duration == 0) return; anim->setDuration(duration); if(parser->toFirstChild()) { do { if(parser->hasAttribute(L"val")) { float val = parser->getFloat(L"val", 0); int32 dur = parser->getInt(L"duration", 0); int32 type = parser->getInt(L"type", 0); anim->getKeyFrames().push_back(KeyFrameAnimation<float>::KeyFrame(val, dur, type == 0 ? KFT_Linear : KFT_Discrete)); } } while(parser->toNextChild()); storyboard->children().push_back(StoryBoard::AnimationInfo(time, anim, prop)); } return; } if(type == L"double") { SharedPtr<KeyFrameAnimation<double> > anim = MakeSharedPtr<KeyFrameAnimation<double> >(); int32 time = parser->getInt(L"time", 0); int32 duration = parser->getInt(L"duration", 0); if(duration == 0) return; anim->setDuration(duration); if(parser->toFirstChild()) { do { if(parser->hasAttribute(L"val")) { int32 val = parser->getInt(L"val", 0); int32 dur = parser->getInt(L"duration", 0); int32 type = parser->getInt(L"type", 0); anim->getKeyFrames().push_back(KeyFrameAnimation<double>::KeyFrame(val, dur, type == 0 ? KFT_Linear : KFT_Discrete)); } } while(parser->toNextChild()); storyboard->children().push_back(StoryBoard::AnimationInfo(time, anim, prop)); } return; } if(type == L"uint") { SharedPtr<KeyFrameAnimation<uint32> > anim = MakeSharedPtr<KeyFrameAnimation<uint32> >(); int32 time = parser->getInt(L"time", 0); int32 duration = parser->getInt(L"duration", 0); if(duration == 0) return; anim->setDuration(duration); if(parser->toFirstChild()) { do { if(parser->hasAttribute(L"val")) { int32 val = parser->getInt(L"val", 0); int32 dur = parser->getInt(L"duration", 0); int32 type = parser->getInt(L"type", 0); anim->getKeyFrames().push_back(KeyFrameAnimation<uint32>::KeyFrame(val, dur, type == 0 ? KFT_Linear : KFT_Discrete)); } } while(parser->toNextChild()); storyboard->children().push_back(StoryBoard::AnimationInfo(time, anim, prop)); } return; } if(type == L"color") { // to do } }