2018-05-08 20:03:29 +08:00
|
|
|
#include "..\e2daction.h"
|
2018-05-24 00:58:16 +08:00
|
|
|
#include "..\e2dnode.h"
|
2018-05-08 20:03:29 +08:00
|
|
|
|
|
|
|
|
|
2018-07-28 20:06:27 +08:00
|
|
|
e2d::OpacityBy::OpacityBy(float duration, float opacity)
|
2018-05-22 22:29:42 +08:00
|
|
|
: FiniteTimeAction(duration)
|
2018-05-08 20:03:29 +08:00
|
|
|
{
|
2018-09-04 22:42:34 +08:00
|
|
|
delta_val_ = opacity;
|
2018-05-08 20:03:29 +08:00
|
|
|
}
|
|
|
|
|
|
2018-09-04 22:42:34 +08:00
|
|
|
void e2d::OpacityBy::Init()
|
2018-05-08 20:03:29 +08:00
|
|
|
{
|
2018-09-04 22:42:34 +08:00
|
|
|
FiniteTimeAction::Init();
|
2018-05-10 00:58:43 +08:00
|
|
|
|
2018-09-04 22:42:34 +08:00
|
|
|
if (target_)
|
2018-05-08 20:03:29 +08:00
|
|
|
{
|
2018-09-04 22:42:34 +08:00
|
|
|
start_val_ = target_->GetOpacity();
|
2018-05-08 20:03:29 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-04 22:42:34 +08:00
|
|
|
void e2d::OpacityBy::Update()
|
2018-05-08 20:03:29 +08:00
|
|
|
{
|
2018-09-04 22:42:34 +08:00
|
|
|
FiniteTimeAction::Update();
|
2018-05-08 20:03:29 +08:00
|
|
|
|
2018-09-04 22:42:34 +08:00
|
|
|
if (target_)
|
2018-05-08 20:03:29 +08:00
|
|
|
{
|
2018-09-04 22:42:34 +08:00
|
|
|
target_->SetOpacity(start_val_ + delta_val_ * delta_);
|
2018-05-08 20:03:29 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-04 22:42:34 +08:00
|
|
|
e2d::OpacityBy * e2d::OpacityBy::Clone() const
|
2018-05-08 20:03:29 +08:00
|
|
|
{
|
2018-09-04 22:42:34 +08:00
|
|
|
return new (e2d::autorelease) OpacityBy(duration_, delta_val_);
|
2018-05-08 20:03:29 +08:00
|
|
|
}
|
|
|
|
|
|
2018-09-04 22:42:34 +08:00
|
|
|
e2d::OpacityBy * e2d::OpacityBy::Reverse() const
|
2018-05-08 20:03:29 +08:00
|
|
|
{
|
2018-09-04 22:42:34 +08:00
|
|
|
return new (e2d::autorelease) OpacityBy(duration_, -delta_val_);
|
2018-05-08 20:03:29 +08:00
|
|
|
}
|