Working with Animations in PowerPoint Library

19 Sep 202324 minutes to read

Animations are visual effects for the objects in PowerPoint presentation and animation helps to make a PowerPoint presentation more dynamic. Animation effects can be grouped into four categories.,

  1. Entrance
  2. Emphasis
  3. Exit
  4. Motion paths

Entrance effects can be set to enter the objects with animations during slide show. Emphasis effects animate the objects on the spot. Exit effects allow objects to leave the slide show with animations. Motion Paths allow objects to move around the slide show. Each effect contains variables such as start (On click, with previous and after previous), delay, speed, repeat, and trigger. This makes animations more flexible and interactive. 

Syncfusion Presentation library allows you to animate the text, pictures, shapes, tables, SmartArt graphics, and charts in PowerPoint presentation.

Adding animation effect to shapes

Animation effects can be added to shapes, images, tables, charts and SmartArt diagrams. The following code example demonstrates how to add an animation effect to an shape.

//Create an instance for PowerPoint
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add normal shape to slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Access the animation sequence to create effects
ISequence sequence = slide.Timeline.MainSequence;
//Add bounce effect to the shape
IEffect bounceEffect = sequence.AddEffect(cubeShape, EffectType.Bounce, EffectSubtype.None, EffectTriggerType.OnClick);
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Create an instance for PowerPoint
using (IPresentation pptxDoc = Presentation.Create())
{
    //Add a blank slide to Presentation
    ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
    //Add normal shape to slide
    IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
    //Access the animation sequence to create effects
    ISequence sequence = slide.Timeline.MainSequence;
    //Add bounce effect to the shape
    IEffect bounceEffect = sequence.AddEffect(cubeShape, EffectType.Bounce, EffectSubtype.None, EffectTriggerType.OnClick);
    //Save the Presentation
    pptxDoc.Save("Sample.pptx");
}
'Create an instance for PowerPoint
Using pptxDoc As IPresentation = Presentation.Create()
    'Add a blank slide to Presentation
    Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
    'Add normal shape to slide
    Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300)
    'Access the animation sequence to create effects
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Add bounce effect to the shape
    Dim bounceEffect As IEffect = sequence.AddEffect(cubeShape, EffectType.Bounce, EffectSubtype.None, EffectTriggerType.OnClick)
    'Save the Presentation
    pptxDoc.Save("Sample.pptx")
End Using

You can download a complete working sample from GitHub.

Adding interactive animation

Animations can be interactive when it depends on another slide element., for example, an animation associated with a rectangle is triggered when user clicks an oval shape in the slide. The following code example demonstrates how to set an interactive animation.

//Create an instance for PowerPoint
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add normal shape to slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Add a shape to act as button
IShape buttonShape = slide.Shapes.AddShape(AutoShapeType.Oval, 100,100,50,50);
//Create the interactive sequence to make the animation effects interactive by triggering with button click
ISequence interactiveSequence = slide.Timeline.InteractiveSequences.Add(buttonShape);
//Add Fly effect with top subtype to animate the shape as fly from top
IEffect bounceEffect = interactiveSequence.AddEffect(cubeShape, EffectType.Fly, EffectSubtype.Top, EffectTriggerType.OnClick);
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Create an instance for PowerPoint
using (IPresentation pptxDoc = Presentation.Create())
{
    //Add a blank slide to Presentation
    ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
    //Add normal shape to slide
    IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
    //Add a shape to act as button
    IShape buttonShape = slide.Shapes.AddShape(AutoShapeType.Oval, 100,100,50,50);
    //Create the interactive sequence to make the animation effects interactive by triggering with button click
    ISequence interactiveSequence = slide.Timeline.InteractiveSequences.Add(buttonShape);
    //Add Fly effect with top subtype to animate the shape as fly from top
    IEffect bounceEffect = interactiveSequence.AddEffect(cubeShape, EffectType.Fly, EffectSubtype.Top, EffectTriggerType.OnClick);
    //Save the Presentation
    pptxDoc.Save("Sample.pptx");
}
'Create an instance for PowerPoint
Using pptxDoc As IPresentation = Presentation.Create()
    'Add a blank slide to Presentation
    Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
    'Add normal shape to slide
    Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300)
    'Add a shape to act as button
    Dim buttonShape As IShape = slide.Shapes.AddShape(AutoShapeType.Oval, 100, 100, 50, 50)
    'Create the interactive sequence to make the animation effects interactive by triggering with button click
    Dim interactiveSequence As ISequence = slide.Timeline.InteractiveSequences.Add(buttonShape)
    'Add Fly effect with top subtype to animate the shape as fly from top
    Dim bounceEffect As IEffect = interactiveSequence.AddEffect(cubeShape, EffectType.Fly, EffectSubtype.Top, EffectTriggerType.OnClick)
    'Save the Presentation
    pptxDoc.Save("Sample.pptx")
End Using

You can download a complete working sample from GitHub.

Adding animation to text

Animation effects can be applied to text. The following code example demonstrated how to set an animation effect to a text.

//Loads or open an PowerPoint Presentation
FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open);
IPresentation pptxDoc = Presentation.Open(inputStream);
//Retrieve the first slide from Presentation
ISlide slide = pptxDoc.Slides[0];
//Retrieve the first shape
IShape shape = slide.Shapes[0] as IShape;
//Access the animation sequence to create effects
ISequence sequence = slide.Timeline.MainSequence;
//Add swivel effect with vertical subtype to the shape, build type is used to represent the animate level of the paragraph
IEffect bounceEffect = sequence.AddEffect(shape, EffectType.Swivel, EffectSubtype.Vertical, EffectTriggerType.OnClick, BuildType.ByLevelParagraphs1);
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream(""Result.pptx, FileMode.Create);
pptxDoc.Save(outputStream);
//Open an existing Presentation from file system
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
    //Retrieve the first slide from Presentation
    ISlide slide = pptxDoc.Slides[0];
    //Retrieve the first shape
    IShape shape = slide.Shapes[0] as IShape;
    //Access the animation sequence to create effects
    ISequence sequence = slide.Timeline.MainSequence;
    //Add swivel effect with vertical subtype to the shape, build type is used to represent the animate level of the paragraph
    IEffect bounceEffect = sequence.AddEffect(shape, EffectType.Swivel, EffectSubtype.Vertical, EffectTriggerType.OnClick, BuildType.ByLevelParagraphs1);
    //Save the Presentation to the file system
    pptxDoc.Save("Result.pptx");
}
'Opens an existing Presentation from file system
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
    'Retrieve the first slide from Presentation
    Dim slide As ISlide = pptxDoc.Slides(0)
    'Retrieve the first shape
    Dim shape As IShape = TryCast(slide.Shapes(0), IShape)
    'Access the animation sequence to create effects
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Add swivel effect with vertical subtype to the shape, build type is used to represent the animate level of the paragraph
    Dim bounceEffect As IEffect = sequence.AddEffect(shape, EffectType.Swivel, EffectSubtype.Vertical, EffectTriggerType.OnClick, BuildType.ByLevelParagraphs1)
    'Save the Presentation to the file system
    pptxDoc.Save("Result.pptx")
End Using

You can download a complete working sample from GitHub.

Adding exit animation effect

When you add common animation effects for both entrance and exit types, animation is applied with entrance effect by default. The following code example demonstrates how to set exist type animation for a shape.

//Create an instance for PowerPoint
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add normal shape to slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Access the animation sequence to create effects
ISequence sequence = slide.Timeline.MainSequence;
//Add random bars effect to the shape
IEffect effect = sequence.AddEffect(cubeShape, EffectType.RandomBars, EffectSubtype.None, EffectTriggerType.OnClick);
//Change the preset class type of the effect from default entrance to exit
effect.PresetClassType = EffectPresetClassType.Exit;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Create an instance for PowerPoint
using (IPresentation pptxDoc = Presentation.Create())
{
    //Add a blank slide to Presentation
    ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
    //Add normal shape to slide
    IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
    //Access the animation sequence to create effects
    ISequence sequence = slide.Timeline.MainSequence;
    //Add random bars effect to the shape
    IEffect effect = sequence.AddEffect(cubeShape, EffectType.RandomBars, EffectSubtype.None, EffectTriggerType.OnClick);
    //Change the preset class type of the effect from default entrance to exit
    effect.PresetClassType = EffectPresetClassType.Exit;
    //Save the Presentation
    pptxDoc.Save("Sample.pptx");
}
'Create an instance for PowerPoint
Using pptxDoc As IPresentation = Presentation.Create()
    'Add a blank slide to Presentation
    Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
    'Add normal shape to slide
    Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300)
    'Access the animation sequence to create effects
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Add random bars effect to the shape
    Dim effect As IEffect = sequence.AddEffect(cubeShape, EffectType.RandomBars, EffectSubtype.None, EffectTriggerType.OnClick)
    'Change the preset class type of the effect from default entrance to exit
    effect.PresetClassType = EffectPresetClassType.[Exit]
    'Save the Presentation
    pptxDoc.Save("Sample.pptx")
End Using

You can download a complete working sample from GitHub.

Edit existing animation effect

The Presentation library allows you to edit the animations in existing presentations. The following example demonstrates how to modify an existing animation applied to a shape.

//Loads or open an PowerPoint Presentation
FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open);
IPresentation pptxDoc = Presentation.Open(inputStream);
//Retrieve the first slide from Presentation
ISlide slide = pptxDoc.Slides[0];
//Retrieve the first shape
IShape shape = slide.Shapes[0] as IShape;
//Access the animation main sequence to modify the effects
ISequence sequence = slide.Timeline.MainSequence;
//Get the animation effects of the particular shape
IEffect[] animationEffects = sequence.GetEffectsByShape(shape);
//Iterate the animation effect to make the change
IEffect animationEffect = animationEffects[0];
//Change the animation effect type from swivel to GrowAndTurn
animationEffect.Type = EffectType.GrowAndTurn;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Animation.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Open an existing Presentation from file system
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
    //Retrieve the first slide from Presentation
    ISlide slide = pptxDoc.Slides[0];
    //Retrieve the first shape
    IShape shape = slide.Shapes[0] as IShape;
    //Access the animation main sequence to modify the effects
    ISequence sequence = slide.Timeline.MainSequence;
    //Get the animation effects of the particular shape
    IEffect[] animationEffects = sequence.GetEffectsByShape(shape);
    //Iterate the animation effect to make the change
    IEffect animationEffect = animationEffects[0];
    //Change the animation effect type from swivel to GrowAndTurn
    animationEffect.Type = EffectType.GrowAndTurn;
    //Save the Presentation to the file system
    pptxDoc.Save("Animation.pptx");
}
'Open an existing Presentation from file system
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
    'Retrieve the first slide from Presentation
    Dim slide As ISlide = pptxDoc.Slides(0)
    'Retrieve the first shape.
    Dim shape As IShape = TryCast(slide.Shapes(0), IShape)
    'Access the animation main sequence to modify the effects
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Get the animation effects of the particular shape
    Dim animationEffects As IEffect() = sequence.GetEffectsByShape(shape)
    'Iterate the animation effect to make the change
    Dim animationEffect As IEffect = animationEffects(0)
    'Change the animation effect type from swivel to GrowAndTurn
    animationEffect.Type = EffectType.GrowAndTurn
    'Save the Presentation to the file system
    pptxDoc.Save("Animation.pptx")
End Using

You can download a complete working sample from GitHub.

Modifying animation effect sub type

Presentation library allows you to edit the sub type of animations effects in existing presentations. The following example demonstrates how to modify a sub type applied to the existing animation.

//Loads or open an PowerPoint Presentation
FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open);
IPresentation pptxDoc = Presentation.Open(inputStream);
//Retrieves the first slide from Presentation
ISlide slide = pptxDoc.Slides[0];
//Retrieves the first shape
IShape shape = slide.Shapes[0] as IShape;
//Access the animation main sequence to modify the effects
ISequence sequence = slide.Timeline.MainSequence;
//Get the required animation effect from the slide
IEffect wheelEffect = sequence[0] as IEffect;
//Change the wheel animation effect sub type from 2 spoke to 4 spoke
wheelEffect.Subtype = EffectSubtype.Wheel4;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Animation.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Opens an existing Presentation from file system
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
    //Retrieves the first slide from Presentation
    ISlide slide = pptxDoc.Slides[0];
    //Retrieves the first shape
    IShape shape = slide.Shapes[0] as IShape;
    //Access the animation main sequence to modify the effects
    ISequence sequence = slide.Timeline.MainSequence;
    //Get the required animation effect from the slide            
    IEffect wheelEffect = sequence[0] as IEffect;
    //Change the wheel animation effect sub type from 2 spoke to 4 spoke
    wheelEffect.Subtype = EffectSubtype.Wheel4;
    //Saves the Presentation to the file system
    pptxDoc.Save("Result.pptx");
}
'Opens an existing Presentation from file system
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
    'Retrieves the first slide from Presentation
    Dim slide As ISlide = pptxDoc.Slides(0)
    'Retrieves the first shape
    Dim shape As IShape = TryCast(slide.Shapes(0), IShape)
    'Access the animation main sequence to modify the effects
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Get the required animation effect from the slide            
    Dim wheelEffect As IEffect = TryCast(sequence(0), IEffect)
    'Change the wheel animation effect sub type from 2 spoke to 4 spoke
    wheelEffect.Subtype = EffectSubtype.Wheel4
    'Saves the Presentation to the file system
    pptxDoc.Save("Result.pptx")
End Using

You can download a complete working sample from GitHub.

Modifying timing of animation effect

Presentation library allows you to edit the animation timing in the existing presentations. The following example demonstrates how to modify an existing animation timing applied to a shape.

//Loads or open an PowerPoint Presentation
FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open);
IPresentation pptxDoc = Presentation.Open(inputStream);
//Retrieves the first slide from Presentation
ISlide slide = pptxDoc.Slides[0];
//Retrieves the first shape
IShape shape = slide.Shapes[0] as IShape;
//Access the animation main sequence to modify the effects
ISequence sequence = slide.Timeline.MainSequence;
//Get the required animation effect from the slide            
IEffect pathEffect = sequence[0] as IEffect;
//Increase the duration of the animation effect
pathEffect.Behaviors[0].Timing.Duration = 5;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Animation.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Open an existing Presentation from file system
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
    //Retrieves the first slide from Presentation
    ISlide slide = pptxDoc.Slides[0];
    //Retrieves the first shape
    IShape shape = slide.Shapes[0] as IShape;
    //Access the animation main sequence to modify the effects
    ISequence sequence = slide.Timeline.MainSequence;
    //Get the required animation effect from the slide            
    IEffect pathEffect = sequence[0] as IEffect;
    //Increase the duration of the animation effect
    pathEffect.Behaviors[0].Timing.Duration = 5;
    //Saves the Presentation to the file system
    pptxDoc.Save("Result.pptx");
}
'Open an existing Presentation from file system
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
    'Retrieves the first slide from Presentation
    Dim slide As ISlide = pptxDoc.Slides(0)
    'Retrieves the first shape
    Dim shape As IShape = TryCast(slide.Shapes(0), IShape)
    'Access the animation main sequence to modify the effects
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Get the required animation effect from the slide
    Dim pathEffect As IEffect = TryCast(sequence(0), IEffect)
    'Increase the duration of the animation effect
    pathEffect.Behaviors(0).Timing.Duration = 5
    'Save the Presentation to the file system.
    pptxDoc.Save("Result.pptx")
End Using

You can download a complete working sample from GitHub.

Reordering the animation effects

Presentation library allows you to reorder the animation effects in existing presentations. The following example demonstrates how to modify an existing animation order applied to a shape.

//Loads or open an PowerPoint Presentation
FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open);
IPresentation pptxDoc = Presentation.Open(inputStream);
//Iterate the slide
ISlide slide = pptxDoc.Slides[0];
//Iterate the shape
IShape shape = slide.Shapes[0] as IShape;
//Iterate the sequence
ISequence sequence = slide.Timeline.MainSequence;
//Get the animation effects of the shape
IEffect[] shapeAnimationEffects = sequence.GetEffectsByShape(shape);
//Get the second animation effect of the shape
IEffect effect = shapeAnimationEffects[1];
//Remove the animation effect from the sequence
sequence.Remove(effect);
//Insert the removed animation effect as first
sequence.Insert(0, effect);
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Animation.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Open the existing presentation
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
    //Iterate the slide
    ISlide slide = pptxDoc.Slides[0];
    //Iterate the shape
    IShape shape = slide.Shapes[0] as IShape;
    //Iterate the sequence
    ISequence sequence = slide.Timeline.MainSequence;
    //Get the animation effects of the shape
    IEffect[] shapeAnimationEffects = sequence.GetEffectsByShape(shape);
    //Get the second animation effect of the shape
    IEffect effect = shapeAnimationEffects[1];
    //Remove the animation effect from the sequence
    sequence.Remove(effect);
    //Insert the removed animation effect as first
    sequence.Insert(0, effect);
    //Save the created presentation
    pptxDoc.Save("Output.pptx");
}
'Open the existing presentation
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
    'Iterate the slide
    Dim slide As ISlide = pptxDoc.Slides(0)
    'Iterate the shape
    Dim shape As IShape = TryCast(slide.Shapes(0), IShape)
    'Iterate the sequence
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Get the animation effects of the shape
    Dim shapeAnimationEffects As IEffect() = sequence.GetEffectsByShape(shape)
    'Get the second animation effect of the shape
    Dim effect As IEffect = shapeAnimationEffects(1)
    'Remove the animation effect from the sequence
    sequence.Remove(effect)
    'Insert the removed animation effect as first
    sequence.Insert(0, effect)
    'Save the created presentation
    pptxDoc.Save("Output.pptx")
End Using

You can download a complete working sample from GitHub.

Creating custom path animation effect

Presentation library allows you to create and modify the custom animations in presentations. The following example demonstrates how to apply a custom animation to a shape.

//Creates an instance for PowerPoint
IPresentation pptxDoc = Presentation.Create();
//Adds a blank slide to Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Adds normal shape to slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 200, 0, 300, 300);
//Access the animation sequence to create effects
ISequence sequence = slide.Timeline.MainSequence;
//Add user path effect to the shape
IEffect bounceEffect = sequence.AddEffect(cubeShape, EffectType.PathUser, EffectSubtype.None, EffectTriggerType.OnClick);
//Add commands to the empty path for moving
IMotionEffect motionBehavior = ((IMotionEffect)bounceEffect.Behaviors[0]);
PointF[] points = new PointF[1];
//Add the move command to move the position of the shape
points[0] = new PointF(0, 0);
motionBehavior.Path.Add(MotionCommandPathType.MoveTo, points, MotionPathPointsType.Auto, false);
//Add the line command to move the shape in straight line
points[0] = new PointF(0, 0.25f);
motionBehavior.Path.Add(MotionCommandPathType.LineTo, points, MotionPathPointsType.Auto, false);
//Add the end command to finish the path animation
motionBehavior.Path.Add(MotionCommandPathType.End, null, MotionPathPointsType.Auto, false);
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Creates an instance for PowerPoint
using (IPresentation pptxDoc = Presentation.Create())
{
    //Adds a blank slide to Presentation
    ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
    //Adds normal shape to slide
    IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 200, 0, 300, 300);
    //Access the animation sequence to create effects
    ISequence sequence = slide.Timeline.MainSequence;
    //Add user path effect to the shape
    IEffect bounceEffect = sequence.AddEffect(cubeShape, EffectType.PathUser, EffectSubtype.None, EffectTriggerType.OnClick);
    //Add commands to the empty path for moving
    IMotionEffect motionBehavior = ((IMotionEffect)bounceEffect.Behaviors[0]);
    PointF[] points = new PointF[1];
    //Add the move command to move the position of the shape
    points[0] = new PointF(0, 0);
    motionBehavior.Path.Add(MotionCommandPathType.MoveTo, points, MotionPathPointsType.Auto, false);
    //Add the line command to move the shape in straight line
    points[0] = new PointF(0, 0.25f);
    motionBehavior.Path.Add(MotionCommandPathType.LineTo, points, MotionPathPointsType.Auto, false);
    //Add the end command to finish the path animation
    motionBehavior.Path.Add(MotionCommandPathType.End, null, MotionPathPointsType.Auto, false);
    //Saves the Presentation
    pptxDoc.Save("Sample.pptx");
}
'Creates an instance for PowerPoint
Using pptxDoc As IPresentation = Presentation.Create()
    'Adds a blank slide to Presentation
    Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
    'Adds normal shape to slide
    Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 200, 0, 300, 300)
    'Access the animation sequence to create effects
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'Add user path effect to the shape
    Dim bounceEffect As IEffect = sequence.AddEffect(cubeShape, EffectType.PathUser, EffectSubtype.None, EffectTriggerType.OnClick)
    'Add commands to the empty path for moving
    Dim motionBehavior As IMotionEffect = DirectCast(bounceEffect.Behaviors(0), IMotionEffect)
    Dim points As PointF() = New PointF(0) {}
    'Add the move command to move the position of the shape
    points(0) = New PointF(0, 0)
    motionBehavior.Path.Add(MotionCommandPathType.MoveTo, points, MotionPathPointsType.Auto, False)
    'Add the line command to move the shape in straight line
    points(0) = New PointF(0, 0.25F)
    motionBehavior.Path.Add(MotionCommandPathType.LineTo, points, MotionPathPointsType.Auto, False)
    'Add the end command to finish the path animation
    motionBehavior.Path.Add(MotionCommandPathType.[End], Nothing, MotionPathPointsType.Auto, False)
    'Saves the Presentation
    pptxDoc.Save("Sample.pptx")
End Using

You can download a complete working sample from GitHub.

Removing animation effect

Presentation library allows you to remove the animation effects from a shape. The following example demonstrates how to remove an animation effect from a shape.

//Loads or open an PowerPoint Presentation
FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open);
IPresentation pptxDoc = Presentation.Open(inputStream);
//Iterate the slide
ISlide slide = pptxDoc.Slides[0];
//Retrieves the first shape
IShape shape = slide.Shapes[0] as IShape;
//Iterate the sequence
ISequence sequence = slide.Timeline.MainSequence;
//To Remove the animation effects from the shape
//Get the animation effects of the particular shape
IEffect[] animationEffects = sequence.GetEffectsByShape(shape);
//Remove the animation effect from the main sequence
foreach (IEffect effect in animationEffects)
{
    sequence.Remove(effect);
}
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Animation.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Open the existing presentation
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
    //Iterate the slide
    ISlide slide = pptxDoc.Slides[0];
    //Retrieves the first shape
    IShape shape = slide.Shapes[0] as IShape;
    //Iterate the sequence
    ISequence sequence = slide.Timeline.MainSequence;
    //To Remove the animation effects from the shape
    //Get the animation effects of the particular shape
    IEffect[] animationEffects = sequence.GetEffectsByShape(shape);
    //Remove the animation effect from the main sequence
    foreach (IEffect effect in animationEffects)
    {
        sequence.Remove(effect);
    }
    //Save the created presentation
    pptxDoc.Save("Result.pptx");
}
'Open the existing presentation
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
    'Iterate the slide
    Dim slide As ISlide = pptxDoc.Slides(0)
    'Retrieves the first shape
    Dim shape As IShape = TryCast(slide.Shapes(0), IShape)
    'Iterate the sequence
    Dim sequence As ISequence = slide.Timeline.MainSequence
    'To Remove the animation effects from the shape
    'Get the animation effects of the particular shape
   Dim animationEffects As IEffect() = sequence.GetEffectsByShape(shape)
    'Remove the animation effect from the main sequence
    For Each effect As IEffect In animationEffects
        sequence.Remove(effect)
    Next
    'Save the created presentation
    pptxDoc.Save("Result.pptx")
End Using

You can download a complete working sample from GitHub.

Supported animation effects type

Syncfusion Presentation library supports the following predefined animation effects with the sub types like Microsoft PowerPoint.

Effects

Entrance

Exit

Emphasis

Motion path

Effect options

Appear Yes Yes - - None
CurveUpDown Yes Yes - - None
Ascend Yes Yes - - None
Blast - - Yes - None
Blinds Yes Yes - -
  • Horizontal
  • Vertical
  • Blink - - Yes - None
    BoldFlash - - Yes - None
    BoldReveal - - Yes - None
    Boomerang Yes Yes - - None
    Bounce Yes Yes - - None
    Box Yes Yes - -
  • In
  • Out
  • BrushOnColor - - Yes - None
    BrushOnUnderline - - Yes - None
    CenterRevolve Yes Yes - - None
    ChangeFillColor - - Yes -
  • Instant
  • Gradual
  • GradualAndCycleClockwise
  • GradualAndCycleCounterClockwise
  • ChangeFont - - Yes -
  • Instant
  • Gradual
  • ChangeFontColor - - Yes -
  • Instant
  • Gradual
  • GradualAndCycleClockwise
  • GradualAndCycleCounterClockwise
  • ChangeFontSize - - Yes -
  • Instant
  • Gradual
  • ChangeFontStyle - - Yes -
  • FontBold
  • FontItalic
  • FontUnderline
  • ChangeLineColor - - Yes -
  • Instant
  • Gradual
  • GradualAndCycleClockwise
  • GradualAndCycleCounterClockwise
  • Checkerboard Yes Yes - -
  • Vertical
  • Across
  • Circle Yes Yes - -
  • In
  • Out
  • ColorBlend - - Yes - None
    ColorTypewriter Yes Yes - - None
    ColorWave - - Yes - None
    ComplementaryColor - - Yes - None
    ComplementaryColor2 - - Yes - None
    Compress Yes Yes - - None
    ContrastingColor - - Yes - None
    Crawl Yes Yes - -
  • Right
  • Left
  • Top
  • Bottom
  • Credits Yes Yes - - None
    Custom - - - - -
    Darken - - Yes - None
    Desaturate - - Yes - None
    Descend Yes Yes - - None
    Diamond Yes Yes - -
  • In
  • Out
  • Dissolve Yes Yes - - None
    EaseInOut Yes Yes - - None
    Expand Yes Yes - - None
    Fade Yes Yes - - None
    FadedSwivel Yes Yes - - None
    FadedZoom Yes Yes - -
  • None
  • Center
  • FlashBulb - - Yes - None
    FlashOnce Yes Yes - - None
    Flicker - - Yes - None
    Flip Yes Yes - - None
    Float Yes Yes - - None
    Fly Yes Yes - -
  • Right
  • Left
  • Top
  • Bottom
  • TopLeft
  • TopRight
  • BottomLeft
  • BottomRight
  • Fold Yes Yes - - None
    Glide Yes Yes - - None
    GrowAndTurn Yes Yes - - None
    GrowShrink - - Yes - None
    GrowWithColor - - Yes - None
    Lighten - - Yes - None
    LightSpeed Yes Yes - - None
    Path4PointStar - - - Yes None
    Path5PointStar - - - Yes None
    Path6PointStar - - - Yes None
    Path8PointStar - - - Yes None
    PathArcDown - - - Yes None
    PathArcLeft - - - Yes None
    PathArcRight - - - Yes None
    PathArcUp - - - Yes None
    PathBean - - - Yes None
    PathBounceLeft - - - Yes None
    PathBounceRight - - - Yes None
    PathBuzzsaw - - - Yes None
    PathCircle - - - Yes None
    PathCrescentMoon - - - Yes None
    PathCurvedSquare - - - Yes None
    PathCurvedX - - - Yes None
    PathCurvyLeft - - - Yes None
    PathCurvyRight - - - Yes None
    PathCurvyStar - - - Yes None
    PathDecayingWave - - - Yes None
    PathDiagonalDownRight - - - Yes None
    PathDiagonalUpRight - - - Yes None
    PathDiamond - - - Yes None
    PathDown - - - Yes None
    PathEqualTriangle - - - Yes None
    PathFigure8Four - - - Yes None
    PathFootball - - - Yes None
    PathFunnel - - - Yes None
    PathHeart - - - Yes None
    PathHeartbeat - - - Yes None
    PathHexagon - - - Yes None
    PathHorizontalFigure8 - - - Yes None
    PathInvertedSquare - - - Yes None
    PathInvertedTriangle - - - Yes None
    PathLeft - - - Yes None
    PathLoopdeLoop - - - Yes None
    PathNeutron - - - Yes None
    PathOctagon - - - Yes None
    PathParallelogram - - - Yes None
    PathPeanut - - - Yes None
    PathPentagon - - - Yes None
    PathPlus - - - Yes None
    PathPointyStar - - - Yes None
    PathRight - - - Yes None
    PathRightTriangle - - - Yes None
    PathSCurve1 - - - Yes None
    PathSCurve2 - - - Yes None
    PathSineWave - - - Yes None
    PathSpiralLeft - - - Yes None
    PathSpiralRight - - - Yes None
    PathSpring - - - Yes None
    PathSquare - - - Yes None
    PathStairsDown - - - Yes None
    PathSwoosh - - - Yes None
    PathTeardrop - - - Yes None
    PathTrapezoid - - - Yes None
    PathTurnDown - - - Yes None
    PathTurnRight - - - Yes None
    PathTurnUp - - - Yes None
    PathTurnUpRight - - - Yes None
    PathUp - - - Yes None
    PathUser - - - Yes None
    PathVerticalFigure8 - - - Yes None
    PathWave - - - Yes None
    PathZigzag - - - Yes None
    Peek Yes Yes - -
  • Bottom
  • Left
  • Right
  • Top
  • Pinwheel Yes Yes - - None
    Plus Yes Yes - -
  • In
  • Out
  • RandomBars Yes Yes - -
  • Horizontal
  • Vertical
  • RandomEffects Yes Yes - - None
    RiseUp Yes - - - None
    Shimmer - - Yes - None
    Sling Yes Yes - - None
    Spin - - Yes - None
    Spinner - - Yes - None
    Spiral Yes Yes - - None
    Split Yes Yes - -
  • HorizontalIn
  • HorizontalOut
  • VerticalIn
  • VerticalOut
  • Stretch yes Yes - -
  • Right
  • Left
  • Top
  • Bottom
  • Across
  • Strips Yes Yes - -
  • UpLeft
  • UpRight
  • DownLeft
  • DownRight
  • StyleEmphasis - - Yes - None
    Swish Yes Yes - - None
    Swivel Yes Yes - -
  • Horizontal
  • Vertical
  • Teeter - - Yes - None
    Thread - - Yes - None
    Transparency - - Yes - None
    Unfold yes Yes - - None
    VerticalGrow - - Yes - None
    Wave - - Yes - None
    Wedge Yes Yes - - None
    Wheel Yes Yes - -
  • Wheel1
  • Wheel2
  • Wheel3
  • Wheel4
  • Wheel8
  • Whip yes Yes - - None
    Wipe Yes Yes - -
  • Top
  • Right
  • Bottom
  • Left
  • Magnify Yes Yes - - None
    Zoom Yes Yes - -
  • In
  • Out
  • InCenter - only for Entrance type
  • OutBottom - only for Entrance type
  • OutSlightly
  • InSlightly
  • OutCenter - only for Exit type
  • InBottom - only for Exit type