Added support for animation type "layer".

This commit is contained in:
Pieter Hulshoff 2016-06-12 09:25:24 +02:00
parent ef81de1b1b
commit b127b12b4e
4 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,7 @@ bool Tween::getTweenProperty(std::string name, TweenProperty &property)
tweenPropertyMap_["backgroundalpha"] = TWEEN_PROPERTY_BACKGROUND_ALPHA;
tweenPropertyMap_["maxwidth"] = TWEEN_PROPERTY_MAX_WIDTH;
tweenPropertyMap_["maxheight"] = TWEEN_PROPERTY_MAX_HEIGHT;
tweenPropertyMap_["layer"] = TWEEN_PROPERTY_LAYER;
tweenPropertyMap_["nop"] = TWEEN_PROPERTY_NOP;
}

View File

@ -57,5 +57,6 @@ enum TweenProperty
TWEEN_PROPERTY_BACKGROUND_ALPHA,
TWEEN_PROPERTY_MAX_WIDTH,
TWEEN_PROPERTY_MAX_HEIGHT,
TWEEN_PROPERTY_LAYER,
TWEEN_PROPERTY_NOP,
};

View File

@ -302,6 +302,13 @@ bool Component::animate()
baseViewInfo.MaxHeight = tween->animate(elapsedTime, storeViewInfo_.MaxHeight);
break;
case TWEEN_PROPERTY_LAYER:
if (tween->startDefined)
baseViewInfo.Layer = static_cast<unsigned int>(tween->animate(elapsedTime));
else
baseViewInfo.Layer = static_cast<unsigned int>(tween->animate(elapsedTime, storeViewInfo_.Layer));
break;
case TWEEN_PROPERTY_NOP:
break;
}

View File

@ -570,6 +570,7 @@ void ScrollingList::resetTweens(Component *c, AnimationEvents *sets, ViewInfo *c
set->push(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->BackgroundAlpha, nextViewInfo->BackgroundAlpha, scrollTime));
set->push(new Tween(TWEEN_PROPERTY_MAX_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->MaxWidth, nextViewInfo->MaxWidth, scrollTime));
set->push(new Tween(TWEEN_PROPERTY_MAX_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->MaxHeight, nextViewInfo->MaxHeight, scrollTime));
set->push(new Tween(TWEEN_PROPERTY_LAYER, EASE_INOUT_QUADRATIC, currentViewInfo->Layer, nextViewInfo->Layer, scrollTime));
scrollTween->Push(set);
}