22#include <kiwano/2d/animation/Animation.h>
23#include <kiwano/2d/animation/TweenAnimation.h>
24#include <kiwano/2d/animation/PathAnimation.h>
25#include <kiwano/2d/animation/DelayAnimation.h>
26#include <kiwano/2d/animation/FrameAnimation.h>
27#include <kiwano/2d/animation/CustomAnimation.h>
28#include <kiwano/2d/animation/AnimationGroup.h>
73 ptr->SetHandler(handler);
82 ptr->RemoveTargetWhenDone();
129 return const_cast<Animation*
>(ptr.Get());
144 inline operator Animation*()
const
149 inline operator RefPtr<Animation>()
const
154 inline operator bool()
const
156 return ptr !=
nullptr;
160 RefPtr<Animation> ptr;
170inline AnimationWrapper MoveBy(
kiwano::Duration duration,
const Vec2& displacement)
172 return AnimationWrapper(
new MoveByAnimation(duration, displacement));
179inline AnimationWrapper MoveTo(
kiwano::Duration duration,
const Point& distination)
181 return AnimationWrapper(
new MoveToAnimation(duration, distination));
190inline AnimationWrapper JumpBy(
kiwano::Duration duration,
const Vec2& displacement,
float height,
int count = 1)
192 return AnimationWrapper(
new JumpByAnimation(duration, displacement, height, count));
201inline AnimationWrapper JumpTo(
kiwano::Duration duration,
const Point& distination,
float height,
int count = 1)
203 return AnimationWrapper(
new JumpToAnimation(duration, distination, height, count));
212 return AnimationWrapper(
new ScaleByAnimation(duration, scale));
221 return AnimationWrapper(
new ScaleToAnimation(duration, scale));
230 return AnimationWrapper(
new FadeToAnimation(duration, opacity));
238 return AnimationWrapper(
new FadeToAnimation(duration, 1.0f));
246 return AnimationWrapper(
new FadeToAnimation(duration, 0.0f));
255 return AnimationWrapper(
new RotateByAnimation(duration, rotation));
264 return AnimationWrapper(
new RotateToAnimation(duration, rotation));
271inline AnimationWrapper Custom(
kiwano::Duration duration, Function<
void(Actor*,
float)> tween_func)
283inline AnimationWrapper Path(
kiwano::Duration duration, RefPtr<Shape> path,
bool rotating =
false,
float start = 0.f,
286 return AnimationWrapper(
new PathAnimation(duration, path, rotating, start, end));
294 return AnimationWrapper(
new DelayAnimation(delay));
301inline AnimationWrapper Frames(
kiwano::Duration duration, RefPtr<FrameSequence> frame_seq)
303 return AnimationWrapper(
new FrameAnimation(duration, frame_seq));
310inline AnimationWrapper Group(
const Vector<RefPtr<Animation>>& animations,
bool parallel =
false)
312 return AnimationWrapper(
new AnimationGroup(animations, parallel));
动画包装器
Definition: AnimationWrapper.h:41
AnimationWrapper & Handler(RefPtr< AnimationEventHandler > handler)
设置动画结束回调函数
Definition: AnimationWrapper.h:70
AnimationWrapper & RemoveTargetWhenDone()
动画结束时移除目标角色
Definition: AnimationWrapper.h:79
AnimationWrapper & Delay(Duration delay)
设置动画延迟
Definition: AnimationWrapper.h:61
AnimationWrapper Reverse() const
获取反向动画
Definition: AnimationWrapper.h:118
void SetEntity(RefPtr< Animation > ptr)
设置动画
Definition: AnimationWrapper.h:134
AnimationWrapper & Loops(int loops)
设置循环次数
Definition: AnimationWrapper.h:52
AnimationWrapper Clone() const
克隆动画
Definition: AnimationWrapper.h:109
AnimationWrapper & Ease(const EaseFunc &ease)
设置缓动函数
Definition: AnimationWrapper.h:97
Animation * Get() const
获取指针
Definition: AnimationWrapper.h:127
AnimationWrapper & Name(StringView name)
设置名称
Definition: AnimationWrapper.h:88
动画
Definition: Animation.h:103
static RefPtr< CustomAnimation > Create(Duration duration, Function< void(Actor *, float)> tween_func)
创建自定义动画
Definition: CustomAnimation.cpp:31
引用计数智能指针
Definition: RefBasePtr.hpp:35
补间动画
Definition: TweenAnimation.h:37
void SetEaseFunc(const EaseFunc &func)
设置动画速度缓动函数
Definition: TweenAnimation.h:472
时间段
Definition: Duration.h:48