Added animation support for containerX, containerY, containerWidth, and containerHeight.

This commit is contained in:
Pieter Hulshoff 2016-07-23 10:06:32 +02:00
parent a3318ee1d5
commit d1263ccc92
4 changed files with 40 additions and 0 deletions

View File

@ -54,6 +54,10 @@ bool Tween::getTweenProperty(std::string name, TweenProperty &property)
tweenPropertyMap_["maxwidth"] = TWEEN_PROPERTY_MAX_WIDTH;
tweenPropertyMap_["maxheight"] = TWEEN_PROPERTY_MAX_HEIGHT;
tweenPropertyMap_["layer"] = TWEEN_PROPERTY_LAYER;
tweenPropertyMap_["containerx"] = TWEEN_PROPERTY_CONTAINER_X;
tweenPropertyMap_["containery"] = TWEEN_PROPERTY_CONTAINER_Y;
tweenPropertyMap_["containerwidth"] = TWEEN_PROPERTY_CONTAINER_WIDTH;
tweenPropertyMap_["containerheight"] = TWEEN_PROPERTY_CONTAINER_HEIGHT;
tweenPropertyMap_["nop"] = TWEEN_PROPERTY_NOP;
}

View File

@ -58,5 +58,9 @@ enum TweenProperty
TWEEN_PROPERTY_MAX_WIDTH,
TWEEN_PROPERTY_MAX_HEIGHT,
TWEEN_PROPERTY_LAYER,
TWEEN_PROPERTY_CONTAINER_X,
TWEEN_PROPERTY_CONTAINER_Y,
TWEEN_PROPERTY_CONTAINER_WIDTH,
TWEEN_PROPERTY_CONTAINER_HEIGHT,
TWEEN_PROPERTY_NOP,
};

View File

@ -309,6 +309,34 @@ bool Component::animate()
baseViewInfo.Layer = static_cast<unsigned int>(tween->animate(elapsedTime, storeViewInfo_.Layer));
break;
case TWEEN_PROPERTY_CONTAINER_X:
if (tween->startDefined)
baseViewInfo.ContainerX = tween->animate(elapsedTime);
else
baseViewInfo.ContainerX = tween->animate(elapsedTime, storeViewInfo_.ContainerX);
break;
case TWEEN_PROPERTY_CONTAINER_Y:
if (tween->startDefined)
baseViewInfo.ContainerY = tween->animate(elapsedTime);
else
baseViewInfo.ContainerY = tween->animate(elapsedTime, storeViewInfo_.ContainerY);
break;
case TWEEN_PROPERTY_CONTAINER_WIDTH:
if (tween->startDefined)
baseViewInfo.ContainerWidth = tween->animate(elapsedTime);
else
baseViewInfo.ContainerWidth = tween->animate(elapsedTime, storeViewInfo_.ContainerWidth);
break;
case TWEEN_PROPERTY_CONTAINER_HEIGHT:
if (tween->startDefined)
baseViewInfo.ContainerHeight = tween->animate(elapsedTime);
else
baseViewInfo.ContainerHeight = tween->animate(elapsedTime, storeViewInfo_.ContainerHeight);
break;
case TWEEN_PROPERTY_NOP:
break;
}

View File

@ -1162,6 +1162,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
case TWEEN_PROPERTY_WIDTH:
case TWEEN_PROPERTY_X:
case TWEEN_PROPERTY_X_OFFSET:
case TWEEN_PROPERTY_CONTAINER_X:
case TWEEN_PROPERTY_CONTAINER_WIDTH:
fromValue = getHorizontalAlignment(from, 0);
toValue = getHorizontalAlignment(to, 0);
break;
@ -1176,6 +1178,8 @@ void PageBuilder::getAnimationEvents(xml_node<> *node, TweenSet &tweens)
case TWEEN_PROPERTY_Y:
case TWEEN_PROPERTY_Y_OFFSET:
case TWEEN_PROPERTY_FONT_SIZE:
case TWEEN_PROPERTY_CONTAINER_Y:
case TWEEN_PROPERTY_CONTAINER_HEIGHT:
fromValue = getVerticalAlignment(from, 0);
toValue = getVerticalAlignment(to, 0);
break;