mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-07-23 03:02:50 +03:00
Added Action::FadeIn and Action::FadeOut.
Minor fix in Action::Close. --HG-- branch : dev
This commit is contained in:
@@ -17,6 +17,8 @@ class EE_API Close : public Delay {
|
||||
|
||||
protected:
|
||||
Close( const Time& time );
|
||||
|
||||
void onStart() override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ class EE_API Fade : public ActionInterpolation1d {
|
||||
|
||||
Action * reverse() const override;
|
||||
protected:
|
||||
Fade();
|
||||
|
||||
Fade( const Float & start, const Float & end, const Time & duration, const Ease::Interpolation & type, const bool& alphaChilds );
|
||||
|
||||
void onStart() override;
|
||||
@@ -21,8 +23,42 @@ class EE_API Fade : public ActionInterpolation1d {
|
||||
void onUpdate( const Time& time ) override;
|
||||
|
||||
bool mAffectChilds;
|
||||
private:
|
||||
Fade();
|
||||
};
|
||||
|
||||
class EE_API FadeIn : public Fade {
|
||||
public:
|
||||
static FadeIn * New( const Time& duration, const Ease::Interpolation& type = Ease::Linear, const bool& alphaChilds = true );
|
||||
|
||||
void start() override;
|
||||
|
||||
Action * clone() const override;
|
||||
|
||||
Action * reverse() const override;
|
||||
protected:
|
||||
Time mDuration;
|
||||
Ease::Interpolation mType;
|
||||
|
||||
FadeIn();
|
||||
|
||||
FadeIn( const Time & duration, const Ease::Interpolation & type, const bool& alphaChilds );
|
||||
};
|
||||
|
||||
class EE_API FadeOut: public Fade {
|
||||
public:
|
||||
static FadeOut * New( const Time& duration, const Ease::Interpolation& type = Ease::Linear, const bool& alphaChilds = true );
|
||||
|
||||
void start() override;
|
||||
|
||||
Action * clone() const override;
|
||||
|
||||
Action * reverse() const override;
|
||||
protected:
|
||||
Time mDuration;
|
||||
Ease::Interpolation mType;
|
||||
|
||||
FadeOut();
|
||||
|
||||
FadeOut( const Time & duration, const Ease::Interpolation & type, const bool& alphaChilds );
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
@@ -25,4 +25,8 @@ Close::Close(const Time & time) :
|
||||
Delay( time )
|
||||
{}
|
||||
|
||||
void Close::onStart() {
|
||||
update(Seconds(0));
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
@@ -9,11 +9,15 @@ Delay * Delay::New(const Time & time) {
|
||||
void Delay::start() {
|
||||
mClock.restart();
|
||||
|
||||
onStart();
|
||||
|
||||
sendEvent( ActionType::OnStart );
|
||||
}
|
||||
|
||||
void Delay::stop() {
|
||||
// 'Cause none of them can stop the time
|
||||
onStop();
|
||||
|
||||
sendEvent( ActionType::OnStop );
|
||||
}
|
||||
|
||||
|
||||
@@ -52,4 +52,84 @@ Action * Fade::reverse() const {
|
||||
return action;
|
||||
}
|
||||
|
||||
FadeIn * FadeIn::New(const Time & duration, const Ease::Interpolation & type, const bool & alphaChilds) {
|
||||
return eeNew( FadeIn, ( duration, type, alphaChilds ) );
|
||||
}
|
||||
|
||||
Action * FadeIn::clone() const {
|
||||
FadeIn * action = eeNew( FadeIn, () );
|
||||
action->mAffectChilds = mAffectChilds;
|
||||
action->mDuration = mDuration;
|
||||
action->mType = mType;
|
||||
action->setInterpolation( mInterpolation );
|
||||
return action;
|
||||
}
|
||||
|
||||
Action * FadeIn::reverse() const {
|
||||
FadeIn * action = eeNew( FadeIn, () );
|
||||
action->mAffectChilds = mAffectChilds;
|
||||
action->mDuration = mDuration;
|
||||
action->mType = mType;
|
||||
action->setInterpolation( Interpolation1d( mInterpolation.getReversePoints() ) );
|
||||
return action;
|
||||
}
|
||||
|
||||
void FadeIn::start() {
|
||||
mInterpolation.clear().add( mNode->getAlpha(), mDuration ).add( 255.f ).setType( mType );
|
||||
|
||||
Fade::start();
|
||||
}
|
||||
|
||||
FadeIn::FadeIn() :
|
||||
Fade()
|
||||
{}
|
||||
|
||||
FadeIn::FadeIn( const Time & duration, const Ease::Interpolation & type, const bool& alphaChilds ) :
|
||||
Fade(),
|
||||
mDuration( duration ),
|
||||
mType( type )
|
||||
{
|
||||
mAffectChilds = alphaChilds;
|
||||
}
|
||||
|
||||
FadeOut * FadeOut::New(const Time & duration, const Ease::Interpolation & type, const bool & alphaChilds) {
|
||||
return eeNew( FadeOut, ( duration, type, alphaChilds ) );
|
||||
}
|
||||
|
||||
Action * FadeOut::clone() const {
|
||||
FadeOut * action = eeNew( FadeOut, () );
|
||||
action->mAffectChilds = mAffectChilds;
|
||||
action->mDuration = mDuration;
|
||||
action->mType = mType;
|
||||
action->setInterpolation( mInterpolation );
|
||||
return action;
|
||||
}
|
||||
|
||||
Action * FadeOut::reverse() const {
|
||||
FadeOut * action = eeNew( FadeOut, () );
|
||||
action->mAffectChilds = mAffectChilds;
|
||||
action->mDuration = mDuration;
|
||||
action->mType = mType;
|
||||
action->setInterpolation( Interpolation1d( mInterpolation.getReversePoints() ) );
|
||||
return action;
|
||||
}
|
||||
|
||||
void FadeOut::start() {
|
||||
mInterpolation.clear().add( mNode->getAlpha(), mDuration ).add( 0.f ).setType( mType );
|
||||
|
||||
Fade::start();
|
||||
}
|
||||
|
||||
FadeOut::FadeOut() :
|
||||
Fade()
|
||||
{}
|
||||
|
||||
FadeOut::FadeOut( const Time & duration, const Ease::Interpolation & type, const bool& alphaChilds ) :
|
||||
Fade(),
|
||||
mDuration( duration ),
|
||||
mType( type )
|
||||
{
|
||||
mAffectChilds = alphaChilds;
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
Reference in New Issue
Block a user