mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-08 15:10:14 +01:00
Added background-alpha tweening.
This commit is contained in:
parent
f823d497a9
commit
ac3552ff91
@ -55,6 +55,7 @@ bool Tween::GetTweenProperty(std::string name, TweenProperty &property)
|
||||
TweenPropertyMap["xoffset"] = TWEEN_PROPERTY_X_OFFSET;
|
||||
TweenPropertyMap["yoffset"] = TWEEN_PROPERTY_Y_OFFSET;
|
||||
TweenPropertyMap["fontSize"] = TWEEN_PROPERTY_FONT_SIZE;
|
||||
TweenPropertyMap["backgroundalpha"] = TWEEN_PROPERTY_BACKGROUND_ALPHA;
|
||||
}
|
||||
|
||||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||
|
||||
@ -41,5 +41,6 @@ enum TweenProperty
|
||||
TWEEN_PROPERTY_Y_ORIGIN,
|
||||
TWEEN_PROPERTY_X_OFFSET,
|
||||
TWEEN_PROPERTY_Y_OFFSET,
|
||||
TWEEN_PROPERTY_FONT_SIZE
|
||||
TWEEN_PROPERTY_FONT_SIZE,
|
||||
TWEEN_PROPERTY_BACKGROUND_ALPHA,
|
||||
};
|
||||
|
||||
@ -314,6 +314,10 @@ bool Component::Animate(bool loop)
|
||||
case TWEEN_PROPERTY_FONT_SIZE:
|
||||
GetBaseViewInfo()->SetFontSize(value);
|
||||
break;
|
||||
|
||||
case TWEEN_PROPERTY_BACKGROUND_ALPHA:
|
||||
GetBaseViewInfo()->SetBackgroundAlpha(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -334,6 +334,7 @@ void ScrollingList::Update(float dt)
|
||||
currentViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth());
|
||||
nextViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight());
|
||||
nextViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth());
|
||||
nextViewInfo->SetBackgroundAlpha(c->GetBaseViewInfo()->GetBackgroundAlpha());
|
||||
|
||||
//todo: 30 is a magic number
|
||||
ViewInfo *spriteViewInfo = c->GetBaseViewInfo();
|
||||
@ -349,6 +350,7 @@ void ScrollingList::Update(float dt)
|
||||
spriteViewInfo->SetAlpha(Tween::AnimateSingle(LINEAR, currentViewInfo->GetAlpha(), nextViewInfo->GetAlpha(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetAngle(Tween::AnimateSingle(LINEAR, currentViewInfo->GetAngle(), nextViewInfo->GetAngle(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetFontSize(Tween::AnimateSingle(LINEAR, currentViewInfo->GetFontSize(), nextViewInfo->GetFontSize(), scrollPeriod, CurrentAnimateTime));
|
||||
spriteViewInfo->SetBackgroundAlpha(Tween::AnimateSingle(LINEAR, currentViewInfo->GetBackgroundAlpha(), nextViewInfo->GetBackgroundAlpha(), scrollPeriod, CurrentAnimateTime));
|
||||
c->Update(dt);
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user