Skip to content

Commit

Permalink
Add 'Set Comp Duration to X Frames'
Browse files Browse the repository at this point in the history
  • Loading branch information
zlovatt committed Sep 21, 2022
1 parent a9eb7a1 commit 73275fa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Set Comp Duration to X Frames.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Sets the active comp's duration to a specified number of frames
*
* @author Zack Lovatt <[email protected]>
* @version 0.1.0
*/
(function setCompDurationToXFrames() {
var NUM_FRAMES = 1;

var comp = app.project.activeItem;

if (!(comp && comp instanceof CompItem)) {
alert('Please select a composition!', 'Set Comp Duration to X Frames');
return;
}

var framesInSeconds = Math.max(NUM_FRAMES, 1) / comp.frameRate;

app.beginUndoGroup('Set Comp Dur to ' + NUM_FRAMES.toString() + ' Frames');
comp.duration = framesInSeconds;
app.endUndoGroup();
})();
19 changes: 19 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,25 @@ Selects unparented layers in current comp.

---

<div>
<div>
<div>
<div>

#### [Set Comp Duration to X Frames](https://raw.githubusercontent.com/zlovatt/zl_Scriptlets/master/Set&#32;Comp&#32;Duration&#32;to&#32;X&#32;Frames.jsx)

</div>
<div>

Sets the active comp's duration to a specified number of frames

</div>
</div>
</div>
</div>

---

<div>
<div>
<div>
Expand Down

0 comments on commit 73275fa

Please sign in to comment.