アニメーション
Contents
[
Hide
]
この記事では、Aspose.Slides for C++ を使用してシンプルなアニメーションを作成し、シーケンスを管理する方法を示します。
アニメーションの追加
クリック時にトリガーされるフェードイン効果を、長方形のシェイプに適用します。
static void AddAnimation()
{
auto presentation = MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 100, 100);
// フェード効果。
slide->get_Timeline()->get_MainSequence()->AddEffect(
shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick);
presentation->Dispose();
}
アニメーションへのアクセス
スライドのタイムラインから最初のアニメーション効果を取得します。
static void AccessAnimation()
{
auto presentation = MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 100, 100);
slide->get_Timeline()->get_MainSequence()->AddEffect(
shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick);
// 最初のアニメーション効果にアクセスする。
auto effect = slide->get_Timeline()->get_MainSequenceEffect(0);
presentation->Dispose();
}
アニメーションの削除
シーケンスからアニメーション効果を削除します。
static void RemoveAnimation()
{
auto presentation = MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 100, 100);
auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(
shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick);
// エフェクトを削除する。
slide->get_Timeline()->get_MainSequence()->Remove(effect);
presentation->Dispose();
}
アニメーションのシーケンス
複数の効果を追加し、アニメーションが実行される順序を示します。
static void SequenceAnimations()
{
auto presentation = MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto shape1 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 100, 100);
auto shape2 = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 200, 50, 100, 100);
auto sequence = slide->get_Timeline()->get_MainSequence();
sequence->AddEffect(shape1, EffectType::Fly, EffectSubtype::Bottom, EffectTriggerType::OnClick);
sequence->AddEffect(shape2, EffectType::Fly, EffectSubtype::Bottom, EffectTriggerType::OnClick);
presentation->Dispose();
}