Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to add transition by script

Participant ,
Jun 28, 2020 Jun 28, 2020

Hello guys,

 

Please help me.

 

I try create an action to add transition but can't work. Is it possible with scripts?

 

I want add "Cross Fade" with duration 4s to all layer in Video group.

 

I appreciate any help.

 

Thank you so much!

Capture.JPGexpand image

TOPICS
Actions and scripting
410
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jun 29, 2020 Jun 29, 2020

* before starting the script, at least one layer in the desired video group must be selected

 

#target photoshop

var s2t = stringIDToTypeID,
    p = app.activeDocument.activeLayer.parent,
    len = p.layers.length - 1

for (var i = len; i > 0; i--) {
    selectLayers([p.layers[i].id, p.layers[i - 1].id])
    addTimelineTransition(4)
}

function selectLayers(IDList) {
    var r = new ActionReference();
    for (var i = 0; i < IDList.length; i++) { r.putIdentifier(s2t("layer"), IDList[i]) }
    (d 
...
Translate
Adobe
Guide ,
Jun 29, 2020 Jun 29, 2020

* before starting the script, at least one layer in the desired video group must be selected

 

#target photoshop

var s2t = stringIDToTypeID,
    p = app.activeDocument.activeLayer.parent,
    len = p.layers.length - 1

for (var i = len; i > 0; i--) {
    selectLayers([p.layers[i].id, p.layers[i - 1].id])
    addTimelineTransition(4)
}

function selectLayers(IDList) {
    var r = new ActionReference();
    for (var i = 0; i < IDList.length; i++) { r.putIdentifier(s2t("layer"), IDList[i]) }
    (d = new ActionDescriptor()).putReference(s2t("null"), r);
    executeAction(s2t("select"), d, DialogModes.NO)
}

function addTimelineTransition(seconds) {
    (d = new ActionDescriptor()).putObject(s2t("using"), s2t("crossDissolveTransition"), new ActionDescriptor());
    (d1 = new ActionDescriptor()).putInteger(s2t("seconds"), seconds);
    d.putObject(s2t("duration"), s2t("timecode"), d1);
    d.putEnumerated(s2t("placement"), s2t("transitionPlacement"), s2t("join"));
    executeAction(s2t("addTimelineTransition"), d, DialogModes.NO);
}

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 29, 2020 Jun 29, 2020
LATEST

That's great! Thank you so much! Have a nice day!

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