Animación
Contents
[
Hide
]
Este artículo muestra cómo crear animaciones simples y gestionar su secuencia utilizando Aspose.Slides for C++.
Agregar una animación
Cree una forma rectangular y aplique un efecto de aparición gradual activado al hacer clic.
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);
// Efecto de desvanecimiento.
slide->get_Timeline()->get_MainSequence()->AddEffect(
shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick);
presentation->Dispose();
}
Acceder a una animación
Obtenga el primer efecto de animación de la línea de tiempo de la diapositiva.
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);
// Acceder al primer efecto de animación.
auto effect = slide->get_Timeline()->get_MainSequenceEffect(0);
presentation->Dispose();
}
Eliminar una animación
Elimine un efecto de animación de la secuencia.
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);
// Eliminar el efecto.
slide->get_Timeline()->get_MainSequence()->Remove(effect);
presentation->Dispose();
}
Secuenciar animaciones
Añada varios efectos y demuestre el orden en que se producen las animaciones.
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();
}