Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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:
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Some more testing with dragging objects around using the GUI.
This time with duplicating by dragging when holding the alt-key.
Also this is reversing the timing groups. And another thing happens:
It is also removing the links on timing groups. Wheras simply dragging leaves the links in order.
Back to scripting:
Moving objects with method move() will not work between documents.
For that we have to use duplicate().
And with using method duplicate() we will also remove the links between timing groups. What is very unfortunate is that there exists no method link() for timing groups. Just unlink(). With method move() we will not unlink the links. We just have to reorder the timing groups if the target is a different spread in the same document.
Regards,
Uwe
Copy link to clipboard
Copied
Uwe, this just keeps getting stranger the more I (and you) examine it!
Yes, I was copy/pasting, not dragging the items in my previous examples. And then also using the Move method as noted. But now, prompted by your last post, I just dragged the items to move them to a new spread in the same document, without holding the option/alt key to duplicate. Here are the results:
Original:
After dragging items to a new spread in the same document:
Note that the Timing order isn't simply reversed in this case!
As I'm forced to use the Move method to duplicate these objects to a new spread in a new document, I'm going to have to find a way to memorize and restore the timing order for each animation.
Copy link to clipboard
Copied
Keith_Gilbert wrote
… As I'm forced to use the Move method to duplicate these objects to a new spread in a new document, I'm going to have to find a way to memorize and restore the timing order for each animation.
Hi Keith,
not only that. You also have to memorize linked timingTargets of a timingGroup.
That will be difficult, because there is no method link() for that. So the only chance is to add() timingGroups with all their properties.
If you'll try that for transferring page items from document to document you have to use duplicate(). move() will not work, I think.
For restoring timing groups with more than one timingTarget you may have to use add() with timingGroups.
What I did not ask—and it could make a difference:
What version of InDesign on what OS are you doing your experiments with?
With me it's InDesign CC 2018.1 on OS X 10.11.6 ( German ).
Regards,
Uwe
Copy link to clipboard
Copied
Uwe, I'm using ID CC 2018.1 on OS X 10.12.6. Thx.
Copy link to clipboard
Copied
Hi Keith,
could you make your little sample document available for download at Dropbox?
Regards,
Uwe
Copy link to clipboard
Copied
Here's a link to my test file: Dropbox - animation_timing_test.indd.zip
Copy link to clipboard
Copied
Thank you for the test document, Keith.
I can confirm your observations.
In the meanwhile I did a more complex sample with more trigger events for one page item.
Not only for DynamicTriggerEvents.ON_PAGE_LOAD, but also ON_PAGE_CLICK, ON_SELF_CLICK and a button object that is working with ON_RELEASE.
In one special case with this new sample I found that moving all page items to a different spread will not change the order in the Timing panel at all.
1. So to get reordering in the Timing panel straight when the pageItem.move() command is used for transfering page items to a different spread—only doable within a document—I will try to find an algorithm with timingGroups.move() to reorder the entries to their original position. For that I will label the timingTargets of a timingGroup with the index of the timingGroup in a given timingList and read out the labels after moving the page items to a new spread.
2. However, this will be by no chance a solution for pageItem.duplicate() to a spread, because another bug will remove the links of timingTargets if they should play together in one timing group. In effect one timingTarget then becomes the only timingTarget of a timingGroup. Still I wrap my head around this problem, but I think the only chance is to remove the new timingGroups in a timingList and use timingGroups.add() to get the right order. And that means, that one has to store all property/value pairs for a timingGroup first to recreate the new one.
If 1. will not work as expected, we also have to remove and add new timingGroups after using the pageItem.move() command in the right order.
Regards,
Uwe
Copy link to clipboard
Copied
Hello Keith,
You could try exporting to a snippet. Although when I did that my animations lost their trigger event.
P.
Copy link to clipboard
Copied
Pickory wrote
Hello Keith,
You could try exporting to a snippet. Although when I did that my animations lost their trigger event.
P.
Hi Pickory,
and not only that!
With one of my samples also items that should animate together will lose their link status to animation groups.
After placing the IDMS file all animation groups consist of eactly one single animation target.
Regards,
Uwe
Copy link to clipboard
Copied
Uwe,
Buttons are a nightmare too! It seems that this ( interactive ) part of InDesign has not really be finished. I am not really surprised, ID was print application with all this other stuff bolted on.
P.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Uwe and Pickory, thanks for all your consideration and insight on this. What a mess! I've decided not to pursue this any further. While it would be an interesting challenge to try to find an algorithmic workaround to these problems, the project budget in this case isn't large enough to justify this.
Copy link to clipboard
Copied
Hi Keith,
tried today something with your sample document:
1. So to get reordering in the Timing panel straight when the pageItem.move() command is used for transfering page items to a different spread—only doable within a document—I will try to find an algorithm with timingGroups.move() to reorder the entries to their original position. For that I will label the timingTargets of a timingGroup with the index of the timingGroup in a given timingList and read out the labels after moving the page items to a new spread.
That worked out ok. I could even produce an array a of the new order in the form:
a =
[
[ 2,[object TimingGroup] ] ,
[ 1,[object TimingGroup] ] ,
[ 3,[object TimingGroup] ] ,
[ 0,[object TimingGroup] ]
]
Where:
a
a
Now a sorting function could convert that array a to the old order:
[
[ 0,[object TimingGroup] ] ,
[ 1,[object TimingGroup] ] ,
[ 2,[object TimingGroup] ] ,
[ 3,[object TimingGroup] ]
]
Here the sorting function:
function NumSortOfSubArray0 (a, b)
{
return a[0] - b[0];
};
Here the sort:
a.sort( NumSortOfSubArray0 );
After sorting I tried with a little loop to move the timing groups to their original position:
for( var n=a.length; n>=0; n-- )
{
a
[1].move( LocationOptions.AT_BEGINNING ); };
That should have done it, but no chance:
The resulting order was not the one I intended…
Tested the sort and the move algorithm also with named layers that I brought in disarray. Sorting and moving the layers back in the original order went as expected, so I think my algorithm works ok. Not so with timing groups in timing lists. So I assume that I see another bug with timing lists perhaps. One additional obstacle is that timing groups have no id number and no property like label and therefore no methods like insertLabel() or extractLabel().
So where to go from there? Plan B:
Try to get all property/value pairs of all timing groups and also all timing lists and redo all lists with all timing groups from scratch after moving or duplicating the page items.
( Sigh.)
Best,
Uwe
Copy link to clipboard
Copied
Now I looked a little closer to the problem.
It seems that using move() on the timingGroup can change the association from timingTarget.dynamicTarget to the timingGroup in array a. Or—but that's hard to proof since timingGroups nor timingTargets have id numbers or a label property where I could add a reference—the timingGroup stored in
( Double sigh… )
Regards,
Uwe
Copy link to clipboard
Copied
Digging a bit deeper, the information is stored at the spread - actually with an object that represents the combination of spread and layer. So for testing completeness sake, even moving objects just across layers is asking for trouble.
Regards,
Dirk
Copy link to clipboard
Copied
Hi Dirk,
thank you very much for that.
Will also test moving layers around. Or objects from layer to layer.
Regards,
Uwe
Copy link to clipboard
Copied
Diane Burns did a bug report on UserVoice about the issues with moving, duplicating, copying animations and the problems that arise with the timeline. Please vote for fixing the issues; everyone who is affected:
Copying animations loses timing panel settings – Adobe InDesign Feedback
Thanks,
Uwe
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
We also discussed here to duplicate or move animations to a different spread in the same document.
Don't know if you tackled this.
Best,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe,
1. The recieving documet will inherit the pasted layer if you have "Paste Remembers Layers" turned on in the flyout menu of the Layers Panel.
2. When you name your layers or the animation element in the animation panel, this name is synced across up to three panels. Name a layer, and when you click on it and open the animation panel, you'll see the name refelcted in animation as well as timing.
3. My posted solution works across pages, spreads and documets.
4. I've attached a simple "Start" file with three circles animated in a specic order. You'll see that the layers are named in the order they have been animated. If you copy and paste all the circles into the "Finish" document and then inspect the layers and timing panels, hopefully you'll see this works as I've advertised.
Good luck!