Add and edit transitions in PowerPoint slides
6 Dec 202417 minutes to read
Slide transitions are the motion effects that occur when you move from one slide to the next during a slide show presentation. A transition can be simple as push type that pushes to the next slide or an airplane type that displays the next slide like an eye-catching effect. You can control the speed, add sound, and customize the properties of transition effects. Transition effects can be grouped into three categories.
- Subtle
- Exciting
- Dynamic Content
Transition effect contains the following properties. This makes slide transition more flexible and interactive.
- Start (after a click or after certain time)
- Duration
- Speed
Set a transition effect to a PowerPoint slide
The following code example demonstrates how to set a transition effect to a PowerPoint slide.
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 100, 100, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Set the transition effect options
slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Across;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream(OutputFileName, FileMode.Create);
pptxDoc.Save(outputStream);
//Close the presentation
pptxDoc.Close();
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 100, 100, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Set the transition effect options
slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Across;
//Save the presentation
pptxDoc.Save("Sample.pptx");
//Close the presentation
pptxDoc.Close();
'Create a PowerPoint presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a shape to the slide
Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 100, 100, 300, 300)
'Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard
'Set the transition effect option
slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Across
'Save the presentation
pptxDoc.Save("Sample.pptx")
'Close the presentation
pptxDoc.Close()
You can download a complete working sample from GitHub.
Modify a transition effect applied to a PowerPoint slide
You can edit the transition effects that already applied to the PowerPoint slides. Refer to the following code example.
//Loads or open an PowerPoint Presentation
FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open);
IPresentation pptxDoc = Presentation.Open(inputStream);
//Retrieve the first slide from the presentation
ISlide slide = pptxDoc.Slides[0];
//Modify the transition effect applied to the slide
slide.SlideTransition.TransitionEffect = TransitionEffect.Cover;
//Set the transition subtype
slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Right;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Transition.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Close the presentation
pptxDoc.Close();
//Open an existing PowerPoint presentation
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Retrieve the first slide from the presentation
ISlide slide = pptxDoc.Slides[0];
//Modify the transition effect applied to the slide
slide.SlideTransition.TransitionEffect = TransitionEffect.Cover;
//Set the transition subtype
slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Right;
//Save the presentation
pptxDoc.Save("Transition.pptx");
//Close the presentation
pptxDoc.Close();
'Open an existing PowerPoint presentation
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Retrieve the first slide from the presentation
Dim slide As ISlide = pptxDoc.Slides(0)
'Modify the transition effect applied to the slide
slide.SlideTransition.TransitionEffect = TransitionEffect.Cover
'Set the transition subtype
slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Right
'Save the presentation
pptxDoc.Save("Transition.pptx")
'Close the presentation
pptxDoc.Close()
You can download a complete working sample from GitHub.
Set the transition duration
You can set the transition duration value up to 59 seconds. This specifies the length of the slide transition to happen. Refer to the following code example.
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
// Set the duration in seconds for the transition effect. Maximum duration value is 59 seconds
slide.SlideTransition.Duration = 40;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Transition.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Close the presentation
pptxDoc.Close();
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
// Set the duration in seconds for the transition effect. Maximum duration value is 59 seconds
slide.SlideTransition.Duration = 40;
//Save the presentation
pptxDoc.Save("Transition.pptx");
//Close the presentation
pptxDoc.Close();
'Create a PowerPoint presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a shape to the slide
Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300)
'Add a shape to the slide
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard
'Set the duration value(sec) for the transition effect. Max duration value is 59 seconds
slide.SlideTransition.Duration = 40
'Save the presentation
pptxDoc.Save("Transition.pptx")
'Close the presentation
pptxDoc.Close()
You can download a complete working sample from GitHub.
Set the transition delay
You can set the transition delay in seconds. This delays the next transactions to happen for a certain number of seconds. The following example demonstrates how to apply the time delay.
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Enable the transition time delay
slide.SlideTransition.TriggerOnTimeDelay = true;
//Assign the value for the advance time delay in seconds
slide.SlideTransition.TimeDelay = 5;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Close the presentation
pptxDoc.Close();
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Enable the transition time delay
slide.SlideTransition.TriggerOnTimeDelay = true;
//Assign the value for the advance time delay in seconds
slide.SlideTransition.TimeDelay = 5;
//Save the presentation
pptxDoc.Save("Sample.pptx");
//Close the presentation
pptxDoc.Close();
'Create a PowerPoint presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a shape to the slide
Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300)
'Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard
'Enable the transition time delay
slide.SlideTransition.TriggerOnTimeDelay = True
'Assign the value for the advance time delay in seconds
slide.SlideTransition.TimeDelay = 5
'Save the presentation
pptxDoc.Save("Sample.pptx")
'Close the presentation
pptxDoc.Close()
You can download a complete working sample from GitHub.
Set the trigger mode for the transition
The next slide transition can be triggered by the following two ways:
- Mouse clicks - Brings the next slide to the view.
- Setting a time - Brings the next slide after that specified time without any interactions.
Syncfusion® PowerPoint library allows you to set both the previously given trigger modes while using PowerPoint slide transitions. Refer to the following code example.
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Set transition advance on click to true. This will enable the next transition after a click
slide.SlideTransition.TriggerOnClick = true;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Close the presentation
pptxDoc.Close();
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Set transition advance on click to true. This will enable the next transition after a click
slide.SlideTransition.TriggerOnClick = true;
//Save the presentation
pptxDoc.Save("Sample.pptx");
//Close the presentation
pptxDoc.Close();
'Create a PowerPoint presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a shape to the slide
Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300)
'Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard
'Set transition advance on click to true. This will enable the next transition after a click
slide.SlideTransition.TriggerOnClick = True
'Save the presentation
pptxDoc.Save("Sample.pptx")
'Close the presentation
pptxDoc.Close()
You can download a complete working sample from GitHub.
Set the speed for transition effect
The speed is the customized property provided by Syncfusion® PowerPoint library to set the transition duration mentioned above (in this page) to a customized enumeration values. By default, each transition will happen for 2 seconds. You can change the following enumeration values to change the duration of a slide transition:
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Set the transition effect speed enumeration. This will reduce the transition duration to 0.75 seconds from the default 2 second
slide.SlideTransition.Speed = TransitionSpeed.Medium;
//Save the PowerPoint Presentation as stream
FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
//Create a PowerPoint presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a shape to the slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300);
//Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard;
//Set the transition effect speed enumeration. This will reduce the transition duration to 0.75 seconds from the default 2 second
slide.SlideTransition.Speed = TransitionSpeed.Medium;
//Save the presentation
pptxDoc.Save("Sample.pptx");
'Create a PowerPoint presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a shape to the slide
Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300)
'Set the transition effect type
slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard
'Set the transition effect speed enumeration. This will reduce the transition duration to 0.75 seconds from the default 2 seconds
slide.SlideTransition.Speed = TransitionSpeed.Medium
'Save the presentation
pptxDoc.Save("Sample.pptx")
You can download a complete working sample from GitHub.
Supported transition effect types:
The following are the list of transition effect options that can be applied to each transition effects.
S.No |
Effects |
Effect Options |
1 | Airplane |
|
2 | Blinds |
|
3 | Box |
|
4 | Checkerboard |
|
5 | Circle | None |
6 | Comb |
|
7 | Conveyor |
|
8 | Cover |
|
9 | Crush | None |
10 | Cube |
|
11 | Curtains | None |
12 | Cut |
|
13 | Diamond | None |
14 | Dissolve | None |
15 | Doors |
|
16 | Drape |
|
17 | FadeAway |
|
18 | FallOver |
|
19 | FerrisWheel |
|
20 | Flashbulb | None |
21 | Flip |
|
22 | FlyThrough |
|
23 | Fracture | None |
24 | Gallery |
|
25 | GlitterDiamond |
|
26 | GlitterHexagon |
|
27 | Honeycomb | None |
28 | Morph |
|
29 | Newsflash | None |
30 | Orbit |
|
31 | Origami |
|
32 | PageCurlDouble |
|
33 | PageCurlSingle |
|
34 | Pan |
|
35 | PeelOff |
|
36 | Plus | None |
37 | Prestige | None |
38 | Push |
|
39 | Random | None |
40 | RandomBars |
|
41 | Reveal |
|
42 | Ripple |
|
43 | Rotate |
|
44 | Shred |
|
45 | Split |
|
46 | Strips |
|
47 | Switch |
|
48 | Uncover |
|
49 | Vortex |
|
50 | Warp |
|
51 | Wedge | None |
52 | Wheel |
|
53 | Wind |
|
54 | Window |
|
55 | Wipe |
|
56 | Zoom |
|
Online Demo
- Explore how to create slide transition effects in a PowerPoint presentation using the .NET PowerPoint Library (Presentation) in a live demo here.