Animação
Contents
[
Hide
]
Este artigo demonstra como criar animações simples e gerenciar sua sequência usando Aspose.Slides for C++.
Adicionar uma Animação
Crie uma forma retangular e aplique um efeito de fade-in acionado ao clicar.
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);
// Efeito de desvanecimento.
slide->get_Timeline()->get_MainSequence()->AddEffect(
shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick);
presentation->Dispose();
}
Acessar uma Animação
Recupere o primeiro efeito de animação da linha do tempo do slide.
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);
// Acesse o primeiro efeito de animação.
auto effect = slide->get_Timeline()->get_MainSequenceEffect(0);
presentation->Dispose();
}
Remover uma Animação
Remova um efeito de animação da sequência.
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);
// Remova o efeito.
slide->get_Timeline()->get_MainSequence()->Remove(effect);
presentation->Dispose();
}
Sequenciar Animações
Adicione vários efeitos e demonstre a ordem em que as animações ocorrem.
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();
}