跳到主要内容

GetInteractiveSequences

返回幻灯片的所有交互式动画序列。

语法

expression.GetInteractiveSequences();

expression - 表示 ApiTimeLine 类的变量。

参数

此方法没有任何参数。

返回值

ApiAnimationSequence[]

示例

此示例从时间线获取所有交互式动画序列。

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);

// Create a trigger shape
const triggerShape = Api.CreateShape(
'ellipse',
80 * 36000, 80 * 36000,
Api.CreateSolidFill(Api.CreateRGBColor(255, 100, 100)),
Api.CreateStroke(0, Api.CreateNoFill())
);
triggerShape.SetPosition(50 * 36000, 100 * 36000);
slide.AddObject(triggerShape);

// Create animated shape
const animatedShape = Api.CreateShape(
'rect',
150 * 36000, 100 * 36000,
Api.CreateSolidFill(Api.CreateRGBColor(61, 74, 107)),
Api.CreateStroke(0, Api.CreateNoFill())
);
animatedShape.SetPosition(180 * 36000, 100 * 36000);
slide.AddObject(animatedShape);

const timeLine = slide.GetTimeLine();

// Create interactive sequence triggered by clicking the red circle
const interactiveSeq = timeLine.AddInteractiveSequence(triggerShape);
interactiveSeq.AddEffect(animatedShape, 'entranceFlyIn', 'onclick');

const sequences = timeLine.GetInteractiveSequences();

const infoShape = Api.CreateShape(
'rect',
200 * 36000, 40 * 36000,
Api.CreateSolidFill(Api.CreateRGBColor(200, 200, 200)),
Api.CreateStroke(0, Api.CreateNoFill())
);
infoShape.SetPosition(20 * 36000, 10 * 36000);
const content = infoShape.GetDocContent();
const paragraph = content.GetElement(0);
paragraph.AddText('Interactive sequences count: ' + sequences.length);
slide.AddObject(infoShape);