Paragraph Animation Introduction
With Aspose.Slides Cloud API, you have the capability to access and manipulate animation effects that are associated with a particular paragraph. For instance, you can retrieve the existing animation settings for a specific paragraph to know how it currently appears in your presentation.
Additionally, you can set or adjust these animation effects. For example, you might want to apply a “Fade In” effect to a specific paragraph to make it smoothly appear during your presentation. By doing so, you are able to customize and enhance the visual impact of your slides, ensuring that your message is conveyed in the most engaging and effective manner possible.
Examples
Add the Blink animation effect to the 1st paragraph of the 2nd shape on the 1st slide in MyPresentation.pptx document. Read information about the animation effect.
cURL Solution
Request
Get an Access Token
Copy curl -X POST "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=MyClientId&client_secret=MyClientSecret" \
-H "Content-Type: application/x-www-form-urlencoded"
Add the Animation Effect
Copy curl -X POST "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/animation/mainSequence" \
-H "authorization: Bearer MyAccessToken" \
-H "Content-Type: application/json" \
-d @ParagraphEffect.json
ParagraphEffect.json content:
Copy {
"type" : "Blink" ,
"shapeIndex" : 2 ,
"paragraphIndex" : 1
}
Get the Animation Effect
Copy curl -X GET "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/animation?shapeIndex=2¶graphIndex=1" \
-H "authorization: Bearer MyAccessToken"
Response
Copy {
"mainSequence" : [
{
"type" : "Blink" ,
"subtype" : "None" ,
"presetClassType" : "Emphasis" ,
"shapeIndex" : 2 ,
"paragraphIndex" : 1 ,
"triggerType" : "OnClick" ,
"duration" : 1.0 ,
"triggerDelayTime" : 0.0
}
],
"interactiveSequences" : [],
"selfUri" : {
"href" : "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1/animation" ,
"relation" : "self" ,
"slideIndex" : 1
}
}
SDK Solutions
C#
Copy var slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var fileName = "MyPresentation.pptx" ;
var slideIndex = 1 ;
var shapeIndex = 2 ;
var paragraphIndex = 1 ;
var paragraphEffect = new Effect
{
Type = Effect . TypeEnum . Blink ,
ShapeIndex = shapeIndex ,
ParagraphIndex = paragraphIndex
};
slidesApi . CreateAnimationEffect ( fileName , slideIndex , paragraphEffect );
SlideAnimation animation = slidesApi . GetAnimation ( fileName , slideIndex , shapeIndex , paragraphIndex );
Console . WriteLine ( animation . MainSequence . Count );
Java
Copy SlidesApi slidesApi = new SlidesApi ( "MyClientId" , "MyClientSecret" );
String fileName = "MyPresentation.pptx" ;
int slideIndex = 1 ;
int shapeIndex = 2 ;
int paragraphIndex = 1 ;
Effect paragraphEffect = new Effect ();
paragraphEffect . setType ( Effect . TypeEnum . BLINK );
paragraphEffect . setShapeIndex ( shapeIndex );
paragraphEffect . setParagraphIndex ( paragraphIndex );
slidesApi . createAnimationEffect ( fileName , slideIndex , paragraphEffect , null , null , null );
SlideAnimation animation = slidesApi . getAnimation ( fileName , slideIndex , shapeIndex , paragraphIndex , null , null , null );
System . out . println ( animation . getMainSequence (). size ());
PHP
Copy use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
use Aspose \Slides \Cloud \Sdk \Model \SlideAnimation ;
use Aspose \Slides \Cloud \Sdk \Model \Effect ;
$config = new Configuration ();
$config -> setAppSid ( "MyClientId" );
$config -> setAppKey ( "MyClientSecret" );
$slidesApi = new SlidesApi ( null , $config );
$fileName = "MyPresentation.pptx" ;
$slideIndex = 1 ;
$shapeIndex = 2 ;
$paragraphIndex = 1 ;
$paragraphEffect = new Effect ();
$paragraphEffect -> setType ( "Blink" );
$paragraphEffect -> setShapeIndex ( $shapeIndex );
$paragraphEffect -> setParagraphIndex ( $paragraphIndex );
$slidesApi -> createAnimationEffect ( $fileName , $slideIndex , $paragraphEffect );
$animation = $slidesApi -> getAnimation ( $fileName , $slideIndex , $shapeIndex , $paragraphIndex );
print ( count ( $animation -> getMainSequence ()));
Ruby
Copy require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
slides_api = SlidesApi . new ( configuration )
file_name = "MyPresentation.pptx"
slide_index = 1
shape_index = 2
paragraph_index = 1
paragraph_effect = Effect . new
paragraph_effect . type = "Blink"
paragraph_effect . shape_index = shape_index
paragraph_effect . paragraph_index = paragraph_index
slides_api . create_animation_effect ( file_name , slide_index , paragraph_effect )
animation = slides_api . get_animation ( file_name , slide_index , shape_index , paragraph_index )
print animation . main_sequence . length
Python
Copy import asposeslidescloud
from asposeslidescloud.configuration import Configuration
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.slide_animation import SlideAnimation
from asposeslidescloud.models.effect import Effect
configuration = Configuration ()
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
slides_api = SlidesApi ( configuration )
file_name = "MyPresentation.pptx"
slide_index = 1
shape_index = 2
paragraph_index = 1
paragraph_effect = Effect ()
paragraph_effect . type = "Blink"
paragraph_effect . shape_index = shape_index
paragraph_effect . paragraph_index = paragraph_index
slides_api . create_animation_effect ( file_name , slide_index , paragraph_effect )
animation = slides_api . get_animation ( file_name , slide_index , shape_index , paragraph_index )
print ( f "{ len (animation.main_sequence) } " )
Node.js
Copy const CloudSdk = require ( "asposeslidescloud" );
const slidesApi = new CloudSdk . SlidesApi ( "MyClientId" , "MyClientSecret" );
const fileName = "MyPresentation.pptx" ;
const slideIndex = 1 ;
const shapeIndex = 2 ;
const paragraphIndex = 1 ;
const paragraphEffect = new CloudSdk . SlideAnimation ();
paragraphEffect . type = CloudSdk . Effect . TypeEnum . Blink ;
paragraphEffect . shapeIndex = shapeIndex ;
paragraphEffect . paragraphIndex = paragraphIndex ;
slidesApi . createAnimationEffect ( fileName , slideIndex , paragraphEffect ). then (() => {
slidesApi . getAnimation ( fileName , slideIndex , shapeIndex , paragraphIndex ). then (( result ) => {
console . log ( result . body . mainSequence . length );
});
});
Go
Copy cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
paragraphEffect := asposeslidescloud . NewEffect ()
paragraphEffect . Type_ = "Blink"
paragraphEffect . ShapeIndex = 2
paragraphEffect . ParagraphIndex = 1
_ , _ , e := api . SlidesApi . CreateAnimationEffect ( "MyPresentation.pptx" , 1 , paragraphEffect , "" , "" , "" )
if e != nil {
fmt . Printf ( "Error: %v." , e )
}
var shapeIndex int32 = 2
var paragraphIndex int32 = 1
animation , _ , e := api . SlidesApi . GetAnimation ( "MyPresentation.pptx" , 1 , & shapeIndex , & paragraphIndex , "" , "MyStorageFolder" , "" )
if e != nil {
fmt . Printf ( "Error: %v." , e )
} else {
fmt . Printf ( "%v effects." , len ( animation . GetMainSequence ()))
}
C++
Copy #include "asposeslidescloud/api/SlidesApi.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = std :: make_shared < SlidesApi > ( L "MyClientId" , L "MyClientSecret" );
auto fileName = L "MyPresentation.pptx" ;
auto slideIndex = 1 ;
auto shapeIndex = 2 ;
auto paragraphIndex = 1 ;
auto paragraphEffect = std :: make_shared < Effect > ();
paragraphEffect -> setType ( L "Blink" );
paragraphEffect -> setShapeIndex ( shapeIndex );
paragraphEffect -> setParagraphIndex ( paragraphIndex );
slidesApi -> createAnimationEffect ( fileName , slideIndex , paragraphEffect );
auto animation = slidesApi -> getAnimation ( fileName , slideIndex , shapeIndex , paragraphIndex ). get ();
std :: cout << animation -> getMainSequence (). size ();
}
Perl
Copy use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::Effect ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $slides_api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
my $file_name = "MyPresentation.pptx" ;
my $slide_index = 1 ;
my $shape_index = 2 ;
my $paragraph_index = 1 ;
my $paragraph_effect = AsposeSlidesCloud::Object::Effect -> new ();
$paragraph_effect -> { type } = "Blink" ;
$paragraph_effect -> { shape_index } = $shape_index ;
$paragraph_effect -> { paragraph_index } = $paragraph_index ;
my %effect_params = ( name => $file_name , slide_index => $slide_index , effect => $paragraph_effect );
$slides_api -> create_animation_effect ( %effect_params );
my %animation_params = ( name => $file_name , slide_index => $slide_index , shape_index => $shape_index , paragraph_index => $paragraph_index );
$animation = $slides_api -> get_animation ( %animation_params );
my $effect_count = @ { $animation -> { main_sequence }};
print ( $effect_count );
Swift
SDKs
Check Available SDKs to learn how to add an SDK to your project.