In this blog post series we are creating animations for InDesign using scripts. If you followed our last post, you saw that there were a number of properties that needed to be set for an object ‘s animation settings to create its animation:

  • duration – the length, in seconds, for the animation
  • motion path – the timeline frame and anchor points for the path the animation will follow plays – the number of times the animation will pay
  • ease type – change for the animation velocity as it begins and ends
  • design option – can be from current appearance or to current appearance
  • initially hidden – will be invisible until animated
  • hidden after – will not be visible at the end of the animation
  • transform offsets – discussed below


To illustrate how transform offsets works, we can think in terms of the transformation proxy (the diagram of nine circles that appears at the top left of the control panel when you create a page item in InDesign.

illustration of transformation proxy Transformation proxy

As you can see, each column can have a number from zero to one with point five (.5) being the center point. When setting the transform offsets for an object’s animation settings, the first item of the transform offsets list represents the column, while the second represents the row. The following scripts illustrate:


tell application "Adobe InDesign CC 2017"
   set measurement unit of script preferences to pixels
   set ruler origin of view preferences of document 1 to page origin
   set spreadRef to active spread of active window
   set objStyle to object style 1 of document 1
   set gBounds to {100, 200, 150, 300}
   set rectRef to my makeDefaultRectangle(spreadRef, gBounds, objStyle)
   tell animation settings of rectRef
	set duration to 2
	set transform offsets to {0,1}
	set rotation array to {{0, 0}, {23, 45}}
   end tell
end tell

on makeDefaultRectangle(spreadRef, gBounds, objStyle)
   tell application "Adobe InDesign CC 2017"
       tell spreadRef
           set myRectangle to make rectangle with properties {geometric bounds:gBounds, object style:objStyle}
       end tell
   end tell
end makeDefaultRectangle


    var myDocument = app.documents[0];
    app.scriptPreferences.measurementUnit = MeasurementUnits.PIXELS;
    var spreadRef = myDocument.spreads[0];
    var objStyle = myDocument.objectStyles[0];
    var gBounds = [100, 200, 150, 300];
    var rectRef = makeDefaultRectangle(spreadRef, gBounds, "Rect1", objStyle);
    rectRef.animationSettings.duration = 2;
    rectRef.animationSettings.rotationArray = [[1,0], [23, 45]];

    function makeDefaultRectangle(spreadRef, gBounds, myString, myStyle){
       var myRectangle = spreadRef.rectangles.add({geometricBounds:gBounds, objectStyle:myStyle, name:myString});
       return myRectangle;


  1. With a document open, run the script
    You should have a rectangle created near the top of your document.
  2. Open the EPUB Interactivity Preview panel (Window > Interactive menu) and click the preview button.
    Your rectangle should animate to rotate around the point set for transform offsets. {1,0}
  3. Change the values for transform offsets to {0,1}
  4. Clean your document, and run the script again.
  5. Click the Clear Preview button in the EPUB Interactivity Preview panel.
  6. Click the preview button

View animation in EPUB Interactivity Preview panel Rectangle rotation viewed in EPUB Interactivity Preview panel

As you can see from the above, the transform offsets property can make a big difference when it comes to rotation.


Notice in the above the rotation array is a list (array) with each item being a list itself where its first item represents timeframe and the second, the degree of rotation.


   set rotation array to {{0, 0}, {23, 45}}


   rectRef.animationSettings.rotationArray = [[1,0], [23, 45]];


A fun idea is to use the transform offsets property to rotate a page item around another. How could this be done? You create the containing rectangle for the rotating object to enclose its target.

For demonstration, in the screen capture below, we have created the rectangle that contains the airplane to enclose that for the world. With the world in the center vertically and horizontally, we can set the transform offsets to {0.5, 0.5}. We have placed the airplane rectangle on a layer named “Plane”. With this} we can write the following script.

Container for airplane sized to place world image in its center Notice how airplane’s container is sized to place the world in its center.


tell application "Adobe InDesign CC 2017"
   set ruler origin of view preferences of document 1 to page origin
   set spreadRef to active spread of active window
   set objRef to page item 1 of layer "Plane" of document 1
   tell animation settings of objRef
      set duration to 3
      set transform offsets to {0.5, 0.5}
      set rotation array to {{0, 0}, {71, 360}}
   end tell	
end tell 


    var myDocument = app.documents[0];
    var spreadRef = myDocument.spreads[0];
    var layerRef = myDocument.layers.itemByName("Plane");
    var objRef = layerRef.pageItems[0];
    objRef.animationSettings.duration = 3;
    objRef.animationSettings.transformOffsets=[0.5, 0.5];
    objRef.animationSettings.rotationArray = [[0,0], [71, 360]];

Notice that the duration is set to 3 so the first element of the second rotation array is 71 representing the timeframe: (24 * 3) – 1. The second element is 360 representing the angle of rotation: 360 degrees.


Come up with some ideas for animating several objects using rotation. Refer back to the AnimationEncyclopedia script provided by Adobe in the Scripts Panel. Page 3 may give you some code to start with.