增加TransitionBox过渡动画
This commit is contained in:
parent
7920099161
commit
6bed7dec95
|
|
@ -100,7 +100,6 @@ void e2d::Transition::_render()
|
|||
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
pRT->PushLayer(_outLayerParam, _outLayer);
|
||||
|
||||
// ה<><D794>¾³<C2BE>¾°
|
||||
_outScene->_render();
|
||||
|
||||
pRT->PopLayer();
|
||||
|
|
@ -120,7 +119,6 @@ void e2d::Transition::_render()
|
|||
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
pRT->PushLayer(_inLayerParam, _inLayer);
|
||||
|
||||
// ה<><D794>¾³<C2BE>¾°
|
||||
_inScene->_render();
|
||||
|
||||
pRT->PopLayer();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
#include "..\e2dtransition.h"
|
||||
#include "..\e2dnode.h"
|
||||
|
||||
e2d::TransitionBox::TransitionBox(double duration)
|
||||
: Transition(duration)
|
||||
{
|
||||
}
|
||||
|
||||
void e2d::TransitionBox::_init(Scene * prev, Scene * next)
|
||||
{
|
||||
Transition::_init(prev, next);
|
||||
_inLayerParam.opacity = 0;
|
||||
}
|
||||
|
||||
void e2d::TransitionBox::_updateCustom()
|
||||
{
|
||||
if (_delta <= 0.5)
|
||||
{
|
||||
_outLayerParam.contentBounds = D2D1::RectF(
|
||||
float(_windowSize.width * _delta),
|
||||
float(_windowSize.height * _delta),
|
||||
float(_windowSize.width * (1 - _delta)),
|
||||
float(_windowSize.height * (1 - _delta))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
_outLayerParam.opacity = 0;
|
||||
_inLayerParam.opacity = 1;
|
||||
_inLayerParam.contentBounds = D2D1::RectF(
|
||||
float(_windowSize.width * (1 - _delta)),
|
||||
float(_windowSize.height * (1 - _delta)),
|
||||
float(_windowSize.width * _delta),
|
||||
float(_windowSize.height * _delta)
|
||||
);
|
||||
if (_delta >= 1)
|
||||
{
|
||||
this->_stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void e2d::TransitionBox::_reset()
|
||||
{
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
// 渐变过渡
|
||||
// 淡入淡出过渡
|
||||
class TransitionFade :
|
||||
public Transition
|
||||
{
|
||||
|
|
@ -84,6 +84,7 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
// 渐变过渡
|
||||
class TransitionEmerge :
|
||||
public Transition
|
||||
{
|
||||
|
|
@ -105,6 +106,29 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
// 盒状过渡
|
||||
class TransitionBox :
|
||||
public Transition
|
||||
{
|
||||
public:
|
||||
TransitionBox(
|
||||
double duration /* 动画持续时长 */
|
||||
);
|
||||
|
||||
protected:
|
||||
// 更新动画
|
||||
virtual void _updateCustom() override;
|
||||
|
||||
virtual void _init(
|
||||
Scene * prev,
|
||||
Scene * next
|
||||
) override;
|
||||
|
||||
virtual void _reset() override;
|
||||
};
|
||||
|
||||
|
||||
// 移入过渡
|
||||
class TransitionMove :
|
||||
public Transition
|
||||
{
|
||||
|
|
|
|||
|
|
@ -258,6 +258,7 @@
|
|||
<ClCompile Include="..\..\core\Tool\Random.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\Timer.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\Transition.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\TransitionBox.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\TransitionEmerge.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\TransitionFade.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\TransitionMove.cpp" />
|
||||
|
|
|
|||
|
|
@ -228,6 +228,9 @@
|
|||
<ClCompile Include="..\..\core\Custom\TextRenderer.cpp">
|
||||
<Filter>Custom</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Transition\TransitionBox.cpp">
|
||||
<Filter>Transition</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\core\easy2d.h" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue