Highlighted

Animation order scrambled after Move method

Participant ,
Mar 20, 2018

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!

Topics

Scripting

Views

832

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Animation order scrambled after Move method

Participant ,
Mar 20, 2018

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!

Topics

Scripting

Views

833

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 20, 2018

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?

MovePageItemsToNewSpread-Timing-TimingGroups-1.png

MovePageItemsToNewSpread-Timing-TimingGroups-2.png

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Mar 20, 2018

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:

Screenshot 2018-03-20 17.30.15.png

After copy/pasting animated objects to new spread:

Screenshot 2018-03-20 17.30.38.png

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:

Screenshot 2018-03-20 17.25.17.png

After using the move method:

Screenshot 2018-03-20 17.25.52.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 20, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 20, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Mar 21, 2018

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:

Screenshot 2018-03-21 07.57.23.png

After dragging items to a new spread in the same document:

Screenshot 2018-03-21 07.57.37.png

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 21, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Advisor ,
Mar 21, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Mar 21, 2018

Copy link to clipboard

Copied

Uwe, I'm using ID CC 2018.1 on OS X 10.12.6. Thx.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 21, 2018

Copy link to clipboard

Copied

Hi Keith,

could you make your little sample document available for download at Dropbox?

Regards,
Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Mar 21, 2018

Copy link to clipboard

Copied

Here's a link to my test file: Dropbox - animation_timing_test.indd.zip

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 22, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 26, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Advisor ,
Mar 26, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 26, 2018

Copy link to clipboard

Copied

Pickory  wrote

… Buttons are a nightmare too! …

Confirmed!

Best,
Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Mar 27, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 27, 2018

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[0] is the original index number of a given timing group before moving it to a different spread and

a[1] holds the corresponding timingGroup that moves along to the new thread with its timing list.

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 28, 2018

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 of array a is not more the same after one or another move()

( Double sigh… )

Regards,
Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Advisor ,
Mar 29, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 30, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Apr 09, 2019

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...