Interface IMotionPath
Represents the motion path.
Inherited Members
System.Collections.Generic.IEnumerable<Syncfusion.Presentation.IMotionCmdPath>.GetEnumerator()
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IMotionPath : IEnumerable<IMotionCmdPath>, IEnumerable
Properties
Count
Get the count of motion path values
Declaration
int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
// Create a new presentation.
IPresentation ppDoc = Presentation.Create();
// Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
// Add shape on the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
// Add animation effect on the slide with shape
IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
// Get the behaviors list from the effect
IBehaviors behaviors = effect.Behaviors;
// Get behavior using foreach loop
foreach (IBehavior behavior in behaviors)
{
if (behavior is IMotionEffect)
{
// Assign the motion effect values
IMotionEffect motionEffect = (behavior as IMotionEffect);
IMotionPath path = (motionEffect.Path as IMotionPath);
int pathCount = path.Count;
break;
}
}
// Save the presentation file
ppDoc.Save("Sample.pptx");
// Close the presentation file
ppDoc.Close();
'Create a new presentation
Dim ppDoc As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add shape on the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
'Add animation effect on the slide with shape
Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
'Get the behaviors list from the effect
Dim behaviors As IBehaviors = effect.Behaviors
'Get behavior using foreach loop
For Each behavior As Behavior In behaviors
'Check condition for behavior is motion effect
If (TypeOf behavior Is MotionEffect) Then
'Assign the motion effect values
Dim motionEffect As MotionEffect = TryCast(behavior,MotionEffect)
Dim path As MotionPath = TryCast(motionEffect.Path, MotionPath)
Dim pathCount As Integer = path.Count
Exit For
End If
Next
'Save the presentation file
ppDoc.Save("Sample.pptx")
'Close the presentation file
ppDoc.Close()
Item[Int32]
Gets a IMotionCmdPath instance at the specified index from the collection. Read-only.
Declaration
IMotionCmdPath this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Determines the index of the effect. |
Property Value
Type | Description |
---|---|
IMotionCmdPath | Returns an IMotionCmdPath instance. |
Examples
// Create a new presentation.
IPresentation ppDoc = Presentation.Create();
// Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
// Add shape on the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
// Add animation effect on the slide with shape
IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
// Get the behaviors list from the effect
IBehaviors behaviors = effect.Behaviors;
// Get behavior using foreach loop
foreach (IBehavior behavior in behaviors)
{
if (behavior is IMotionEffect)
{
// Assign the motion effect values
IMotionEffect motionEffect = (behavior as IMotionEffect);
IMotionPath path = (motionEffect.Path as IMotionPath);
IMotionCmdPath motionPath = (path[0] as IMotionCmdPath);
break;
}
}
// Save the presentation file
ppDoc.Save("Sample.pptx");
// Close the presentation file
ppDoc.Close();
'Create a new presentation
Dim ppDoc As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add shape on the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
'Add animation effect on the slide with shape
Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
'Get the behaviors list from the effect
Dim behaviors As IBehaviors = effect.Behaviors
'Get behavior using foreach loop
For Each behavior As Behavior In behaviors
'Check condition for behavior is motion effect
If (TypeOf behavior Is MotionEffect) Then
'Assign the motion effect values
Dim motionEffect As MotionEffect = TryCast(behavior,MotionEffect)
Dim path As MotionPath = TryCast(motionEffect.Path, MotionPath)
Dim motionPath As MotionCmdPath = TryCast(path(0), MotionCmdPath)
Exit For
End If
Next
'Save the presentation file
ppDoc.Save("Sample.pptx")
'Close the presentation file
ppDoc.Close()
Methods
Add(MotionCommandPathType, PointF[], MotionPathPointsType, Boolean)
Add the motion path values into the list
Declaration
IMotionCmdPath Add(MotionCommandPathType type, PointF[] points, MotionPathPointsType pointsType, bool isRelativeCoord)
Parameters
Type | Name | Description |
---|---|---|
MotionCommandPathType | type | Motion command path type |
System.Drawing.PointF[] | points | |
MotionPathPointsType | pointsType | |
System.Boolean | isRelativeCoord |
Returns
Type | Description |
---|---|
IMotionCmdPath | Return the newly added path |
Examples
// Create a new presentation.
IPresentation ppDoc = Presentation.Create();
// Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
// Add shape on the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
// Add animation effect on the slide with shape
IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
// Get the behaviors list from the effect
IBehaviors behaviors = effect.Behaviors;
//Add the line command to move the shape in straight line
PointF[] points = new PointF[1];
points[0] = new PointF(0, 0.25f);
// Get behavior using foreach loop
foreach (IBehavior behavior in behaviors)
{
if (behavior is IMotionEffect)
{
// Assign the motion effect values
IMotionEffect motionEffect = (behavior as IMotionEffect);
IMotionPath path = (motionEffect.Path as IMotionPath);
path.Add(MotionCommandPathType.LineTo, points, MotionPathPointsType.CurveSmooth, false);
break;
}
}
// Save the presentation file
ppDoc.Save("Sample.pptx");
// Close the presentation file
ppDoc.Close();
'Create a new presentation
Dim ppDoc As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add shape on the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
'Add animation effect on the slide with shape
Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
'Get the behaviors list from the effect
Dim behaviors As IBehaviors = effect.Behaviors
'Get behavior using foreach loop
For Each behavior As Behavior In behaviors
'Check condition for behavior is motion effect
If (TypeOf behavior Is MotionEffect) Then
'Assign the motion effect values
Dim motionEffect As MotionEffect = TryCast(behavior,MotionEffect)
Dim path As MotionPath = TryCast(motionEffect.Path, MotionPath)
path.Add(MotionCommandPathType.LineTo, points, MotionPathPointsType.CurveSmooth, false)
Exit For
End If
Next
'Save the presentation file
ppDoc.Save("Sample.pptx")
'Close the presentation file
ppDoc.Close()
Clear()
Clear the motion command path values from the list
Declaration
void Clear()
Examples
// Create a new presentation.
IPresentation ppDoc = Presentation.Create();
// Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
// Add shape on the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
// Add animation effect on the slide with shape
IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
// Get the behaviors list from the effect
IBehaviors behaviors = effect.Behaviors;
// Get behavior using foreach loop
foreach (IBehavior behavior in behaviors)
{
if (behavior is IMotionEffect)
{
// Assign the motion effect values
IMotionEffect motionEffect = (behavior as IMotionEffect);
IMotionPath path = (motionEffect.Path as IMotionPath);
path.Clear();
break;
}
}
// Save the presentation file
ppDoc.Save("Sample.pptx");
// Close the presentation file
ppDoc.Close();
'Create a new presentation
Dim ppDoc As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add shape on the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
'Add animation effect on the slide with shape
Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
'Get the behaviors list from the effect
Dim behaviors As IBehaviors = effect.Behaviors
'Get behavior using foreach loop
For Each behavior As Behavior In behaviors
'Check condition for behavior is motion effect
If (TypeOf behavior Is MotionEffect) Then
'Assign the motion effect values
Dim motionEffect As MotionEffect = TryCast(behavior,MotionEffect)
Dim path As MotionPath = TryCast(motionEffect.Path, MotionPath)
path.Clear()
Exit For
End If
Next
'Save the presentation file
ppDoc.Save("Sample.pptx")
'Close the presentation file
ppDoc.Close()
Insert(Int32, MotionCommandPathType, PointF[], MotionPathPointsType, Boolean)
Insert the motion path into list with particular index.
Declaration
void Insert(int index, MotionCommandPathType type, PointF[] points, MotionPathPointsType pointsType, bool isRelativeCoord)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index to insert motion path value |
MotionCommandPathType | type | Motion command path type |
System.Drawing.PointF[] | points | |
MotionPathPointsType | pointsType | |
System.Boolean | isRelativeCoord |
Examples
// Create a new presentation.
IPresentation ppDoc = Presentation.Create();
// Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
// Add shape on the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
// Add animation effect on the slide with shape
IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
// Get the behaviors list from the effect
IBehaviors behaviors = effect.Behaviors;
// Get behavior using foreach loop
foreach (IBehavior behavior in behaviors)
{
if (behavior is IMotionEffect)
{
// Assign the motion effect values
IMotionEffect motionEffect = (behavior as IMotionEffect);
IMotionPath path = (motionEffect.Path as IMotionPath);
path.Insert(2, MotionCommandPathType.CurveTo, points, MotionPathPointsType.Smooth, false);
break;
}
}
// Save the presentation file
ppDoc.Save("Sample.pptx");
// Close the presentation file
ppDoc.Close();
'Create a new presentation
Dim ppDoc As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add shape on the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
'Add animation effect on the slide with shape
Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
'Get the behaviors list from the effect
Dim behaviors As IBehaviors = effect.Behaviors
'Get behavior using foreach loop
For Each behavior As Behavior In behaviors
'Check condition for behavior is motion effect
If (TypeOf behavior Is MotionEffect) Then
'Assign the motion effect values
Dim motionEffect As MotionEffect = TryCast(behavior,MotionEffect)
Dim path As MotionPath = TryCast(motionEffect.Path, MotionPath)
path.Insert(2, MotionCommandPathType.CurveTo, points, MotionPathPointsType.Smooth, false)
Exit For
End If
Next
'Save the presentation file
ppDoc.Save("Sample.pptx")
'Close the presentation file
ppDoc.Close()
Remove(IMotionCmdPath)
Remove the particular motion command path value
Declaration
void Remove(IMotionCmdPath item)
Parameters
Type | Name | Description |
---|---|---|
IMotionCmdPath | item | Command path item to remove from the collection |
Examples
// Create a new presentation.
IPresentation ppDoc = Presentation.Create();
// Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
// Add shape on the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
// Add animation effect on the slide with shape
IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
// Get the behaviors list from the effect
IBehaviors behaviors = effect.Behaviors;
// Get behavior using foreach loop
foreach (IBehavior behavior in behaviors)
{
if (behavior is IMotionEffect)
{
// Assign the motion effect values
IMotionEffect motionEffect = (behavior as IMotionEffect);
IMotionPath path = (motionEffect.Path as IMotionPath);
path.Remove(path[1]);
break;
}
}
// Save the presentation file
ppDoc.Save("Sample.pptx");
// Close the presentation file
ppDoc.Close();
'Create a new presentation
Dim ppDoc As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add shape on the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
'Add animation effect on the slide with shape
Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
'Get the behaviors list from the effect
Dim behaviors As IBehaviors = effect.Behaviors
'Get behavior using foreach loop
For Each behavior As Behavior In behaviors
'Check condition for behavior is motion effect
If (TypeOf behavior Is MotionEffect) Then
'Assign the motion effect values
Dim motionEffect As MotionEffect = TryCast(behavior,MotionEffect)
Dim path As MotionPath = TryCast(motionEffect.Path, MotionPath)
path.Remove(path(1))
Exit For
End If
Next
'Save the presentation file
ppDoc.Save("Sample.pptx")
'Close the presentation file
ppDoc.Close()
RemoveAt(Int32)
Remove the particular motion path with index value
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Remove the particular path from collection using index |
Examples
// Create a new presentation.
IPresentation ppDoc = Presentation.Create();
// Add a slide to the presentation.
ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
// Add shape on the slide
IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
// Add animation effect on the slide with shape
IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
// Get the behaviors list from the effect
IBehaviors behaviors = effect.Behaviors;
// Get behavior using foreach loop
foreach (IBehavior behavior in behaviors)
{
if (behavior is IMotionEffect)
{
// Assign the motion effect values
IMotionEffect motionEffect = (behavior as IMotionEffect);
IMotionPath path = (motionEffect.Path as IMotionPath);
path.RemoveAt(0);
break;
}
}
// Save the presentation file
ppDoc.Save("Sample.pptx");
// Close the presentation file
ppDoc.Close();
'Create a new presentation
Dim ppDoc As IPresentation = Presentation.Create()
'Add a slide to the presentation.
Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
'Add shape on the slide
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
'Add animation effect on the slide with shape
Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
'Get the behaviors list from the effect
Dim behaviors As IBehaviors = effect.Behaviors
'Get behavior using foreach loop
For Each behavior As Behavior In behaviors
'Check condition for behavior is motion effect
If (TypeOf behavior Is MotionEffect) Then
'Assign the motion effect values
Dim motionEffect As MotionEffect = TryCast(behavior,MotionEffect)
Dim path As MotionPath = TryCast(motionEffect.Path, MotionPath)
path.RemoveAt(0)
Exit For
End If
Next
'Save the presentation file
ppDoc.Save("Sample.pptx")
'Close the presentation file
ppDoc.Close()