Skip to main content
Inspiring
Dec 7, 2022 10:51 PM UTC
Answered

Timeline: how to set duration of each frame, at the same time?

I'm animating in photoshop.

I have all the frames highlighted, and would like to set each frame duration on 2's. 

When I adjust the size of one of them, only that one frame gets adjusted, but not all the other frames that are highlighted.

Thank you.

jazz-yCorrect answer
Legend
Dec 8, 2022 3:57 PM UTC

This can be done with a script. Initital state:

  1. All frames must be located on the same track. If they are located on different tracks, then the frame duration will be set correctly, but the starting position of each frame will remain unchanged.
  2. Before running the script, you need to select all the frames whose duration should be changed.

 

#target photoshop
s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var selectedLayers = executeActionGet(r).getList(p),
    layers = [],
    frameRate;
(r = new ActionReference()).putProperty(s2t("property"), s2t("time"));
r.putClass(s2t("timeline"));
(d = new ActionDescriptor()).putReference(s2t("null"), r);
(d1 = new ActionDescriptor()).putInteger(s2t("seconds"), 0);
d1.putInteger(s2t("frame"), 0);
d.putObject(s2t("to"), s2t("timecode"), d1);
executeAction(s2t("set"), d, DialogModes.NO);
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('frameRate'));
r.putClass(s2t('timeline'));
frameRate = executeActionGet(r).getDouble(p);
for (var i = 0; i < selectedLayers.count; i++) {
    (r = new ActionReference()).putIdentifier(s2t('layer'), selectedLayers.getReference(i).getIdentifier());
    (d = new ActionDescriptor()).putReference(s2t('null'), r);
    executeAction(s2t('select'), d, DialogModes.NO);
    (d1 = new ActionDescriptor()).putObject(s2t("resetTime"), s2t("timecode"), new ActionDescriptor());
    executeAction(s2t("moveOutTime"), d1, DialogModes.NO);
    (d = new ActionDescriptor()).putInteger(s2t("seconds"), 2);
    d.putInteger(s2t("frame"), -1);
    d.putDouble(s2t('frameRate'), frameRate);
    (d1 = new ActionDescriptor()).putObject(s2t("timeOffset"), s2t("timecode"), d);
    executeAction(s2t("moveOutTime"), d1, DialogModes.NO);
}

 

12 replies

jazz-yCorrect answer
Legend
Dec 8, 2022 3:57 PM UTC

This can be done with a script. Initital state:

  1. All frames must be located on the same track. If they are located on different tracks, then the frame duration will be set correctly, but the starting position of each frame will remain unchanged.
  2. Before running the script, you need to select all the frames whose duration should be changed.

 

#target photoshop
s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var selectedLayers = executeActionGet(r).getList(p),
    layers = [],
    frameRate;
(r = new ActionReference()).putProperty(s2t("property"), s2t("time"));
r.putClass(s2t("timeline"));
(d = new ActionDescriptor()).putReference(s2t("null"), r);
(d1 = new ActionDescriptor()).putInteger(s2t("seconds"), 0);
d1.putInteger(s2t("frame"), 0);
d.putObject(s2t("to"), s2t("timecode"), d1);
executeAction(s2t("set"), d, DialogModes.NO);
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('frameRate'));
r.putClass(s2t('timeline'));
frameRate = executeActionGet(r).getDouble(p);
for (var i = 0; i < selectedLayers.count; i++) {
    (r = new ActionReference()).putIdentifier(s2t('layer'), selectedLayers.getReference(i).getIdentifier());
    (d = new ActionDescriptor()).putReference(s2t('null'), r);
    executeAction(s2t('select'), d, DialogModes.NO);
    (d1 = new ActionDescriptor()).putObject(s2t("resetTime"), s2t("timecode"), new ActionDescriptor());
    executeAction(s2t("moveOutTime"), d1, DialogModes.NO);
    (d = new ActionDescriptor()).putInteger(s2t("seconds"), 2);
    d.putInteger(s2t("frame"), -1);
    d.putDouble(s2t('frameRate'), frameRate);
    (d1 = new ActionDescriptor()).putObject(s2t("timeOffset"), s2t("timecode"), d);
    executeAction(s2t("moveOutTime"), d1, DialogModes.NO);
}

 

Translate
YompaAuthor
Inspiring
Dec 11, 2022 12:57 AM UTC

Thank you!

Translate
Kevin Stohlmeyer
Community Expert
Community Expert
Dec 7, 2022 10:58 PM UTC

 

Select your first frame, then shift select the last frame.

The timing drop down in on the bottom right of the frame you first selected.

 

 

 

Translate
YompaAuthor
Inspiring
Dec 7, 2022 11:03 PM UTC

Thank you.

But is there a way to do this in the Video Timeline mode?

Translate
Kevin Stohlmeyer
Community Expert
Community Expert
Dec 8, 2022 1:52 PM UTC

No there isn't. Premiere Pro would be a better program to do this in if you want advanced controls.

 

Translate
Stephen Marsh
Community Expert
Community Expert
Dec 7, 2022 10:54 PM UTC

With all of the frames selected, just change the "seconds" dropdown value in one frame, the others should all change to the same value.

Translate
YompaAuthor
Inspiring
Dec 7, 2022 10:56 PM UTC

I can't seem to find where the "seconds" dropdown value is. 

Translate