アニメーション
Contents
[
Hide
]
この記事では、Aspose.Slides for Java を使用してシンプルなアニメーションを作成し、そのシーケンスを管理する方法を示します。
アニメーションの追加
矩形シェイプを作成し、クリック時にトリガーされるフェード効果を適用します。
static void addAnimation() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 100, 100);
// フェード効果。
slide.getTimeline().getMainSequence().addEffect(
shape, EffectType.Fade, EffectSubtype.None, EffectTriggerType.OnClick
);
} finally {
presentation.dispose();
}
}
アニメーションへのアクセス
スライドのタイムラインから最初のアニメーション効果を取得します。
static void accessAnimation() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 100, 100);
slide.getTimeline().getMainSequence().addEffect(
shape, EffectType.Fade, EffectSubtype.None, EffectTriggerType.OnClick);
// 最初のアニメーション効果にアクセス。
IEffect effect = slide.getTimeline().getMainSequence().get_Item(0);
} finally {
presentation.dispose();
}
}
アニメーションの削除
シーケンスからアニメーション効果を削除します。
static void removeAnimation() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 100, 100);
IEffect effect = slide.getTimeline().getMainSequence().addEffect(
shape, EffectType.Fade, EffectSubtype.None, EffectTriggerType.OnClick);
// エフェクトを削除。
slide.getTimeline().getMainSequence().remove(effect);
} finally {
presentation.dispose();
}
}
アニメーションのシーケンス
複数の効果を追加し、アニメーションが発生する順序を示します。
static void sequenceAnimations() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape shape1 = slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 100, 100);
IAutoShape shape2 = slide.getShapes().addAutoShape(ShapeType.Ellipse, 200, 50, 100, 100);
ISequence sequence = slide.getTimeline().getMainSequence();
sequence.addEffect(shape1, EffectType.Fly, EffectSubtype.Bottom, EffectTriggerType.OnClick);
sequence.addEffect(shape2, EffectType.Fly, EffectSubtype.Bottom, EffectTriggerType.OnClick);
} finally {
presentation.dispose();
}
}