Skip to main content
Keith_Gilbert
Inspiring
March 20, 2018
Question

Animation order scrambled after Move method

  • March 20, 2018
  • 2 replies
  • 3812 views

I have a script that duplicates all page items from one document to another via:

mySpread.pageItems.everyItem().move(myDestinationSpread);

I'm forced to use "move" instead of "duplicate" for a variety of reasons I won't go into here.

Anyway, it turns out that if there are any animations on the source spread, when they are moved to another spread in the same document, or a spread in a different document, the order of the animation in the timing panel is scrambled. This doesn't happen if the animation is moved to a different page in the same spread, only if it is moved to a different spread.

I can't figure out what logic is being used to calculate the new order of the animation. It seems random. It isn't simply reversing the animation order, nor is it based on the stacking order of objects. Because of this, i've been trying to figure out a way to memorize the animation order on the original spread, and re-apply it on the destination spread, but I'm stumped.

I've figured out that each row in the Timing Panel is a timingGroup, so

mySpread.timingSettings.timingLists[0].timingGroups[4]

addresses the 5th timing Group, for example.

Also

mySpread.timingSettings.timingLists[0].timingGroups[0].timingTargets[0].dynamicTarget

addresses the individual text frame, rectangle, oval, etc. that is being animated.

But for the life of me I can't figure out how to store all this, then move the objects to a new spread, and then re-apply it.

Any pointers would be greatly appreciated!

2 replies

Participant
April 1, 2022

I believe I've partially solved this issue. I say partially because although it works, there are design limitations.

 

I noticed that when animated or non-animated elements are copy/pasted into a different indesign document or moved in any way, what's being honored is the layer stack and not the animation timing stack. The animation timing re-orders according to the order of the layer stack.

 

The solution is to make sure the layer stack is set to the same order as the animation timing order, and when items are pasted into a new doc, the timing remains intact. What helps is to make sure each animated item is named in a clear way to make it easier to re-order the layer stack to match the timing order.

 

Of course, this has possible design limitations when items need to overlap each other in a specific way, but knowing this one can design in such a way to avoid this issue.

 

I hope this helps.

Community Expert
April 1, 2022

Hi David,

thank you very much for your comment.

I'll do some tests later.

 

Could you post two sample documents where you were able to copy the animations over from one document to another?

You refer to the layer stack. So I do assume that the order of layers and also their names should be exactly the same in the recieving document.

 

Regards,
Uwe Laubender

( ACP )

Community Expert
March 20, 2018

Hi Keith,

can you do a little experiment and show some screenshots?

1. Do a screenshot of the Timing panel showing the timing groups.

2. Move the page items without scripting to a new spread in the same document.

3. Do a screenshot of the Timing panel showing the timing groups of the spread you moved the items to.

I just did that with spread one of the document that can be build by executing the AnimationEncylopedia.jsx script from the Samples dircetory in the Scripts Panel.

After moving the page items to a new spread in the same document I can detect a reversed order of the timing groups.

Is that also the case with your test document as well?

To reverse the timing groups is easy:

var targetSpread = app.documents[0].spreads[1];

var timingGroups = targetSpread.timingSettings.timingLists[0].timingGroups.everyItem().getElements();

var timingGroupsLength = timingGroups.length;

for(var n=1;n<timingGroupsLength;n++)

{

    timingGroups.move( LocationOptions.AT_BEGINNING );

};

Regards,
Uwe

Keith_Gilbert
Inspiring
March 20, 2018

Uwe, good idea to test this without scripting. That revealed some more subtlety to this problem. It turns out that copy/pasting animated objects without scripting from one spread to another changes the order of animation on the destination spread to the same order as the stacking order in the layers panel.

Original document:

After copy/pasting animated objects to new spread:

But, it gets weirder. Using the move method to move the objects to another spread ignores the stacking order, and puts the animation in an order that I can't explain.

Before using the move method:

After using the move method:

Community Expert
March 20, 2018

Hi Keith,

not get too much confused here.

Just to make it clear. When I moved the page items from one spread to another I did not copy/paste them. I did not cut/paste them, I just selected all objects on the spread and dragged them from one spread to another in the same document. And with that method I see the timing groups in reverse order in the Timing panel.

You said: "After using the move method".
Was that by scripting? Or did you drag the objects around in the same document?

Regards,
Uwe