-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathISO_RandomizeRotationKeyframes.jsx
More file actions
33 lines (30 loc) · 1.26 KB
/
Copy pathISO_RandomizeRotationKeyframes.jsx
File metadata and controls
33 lines (30 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// ISO_RandomizeRotationKeyframes.jsx
// Artist: https://www.jasonfletcher.info/
// Code generated by ChatGPT-4o
// Date: June 18, 2025
// Description: This After Effects script will randomize all existing rotation keyframes for the selected layer within a comp.
{
var comp = app.project.activeItem;
if (comp && comp instanceof CompItem) {
var layer = comp.selectedLayers[0];
if (layer) {
var rotation = layer.property("ADBE Transform Group").property("ADBE Rotate Z");
if (rotation.numKeys > 0) {
app.beginUndoGroup("Randomize Rotation Keyframes");
for (var i = 1; i <= rotation.numKeys; i++) {
// Randomize rotation between -180 and 180 degrees
var randomValue = (Math.random() * 360) - 180;
rotation.setValueAtKey(i, randomValue);
}
app.endUndoGroup();
alert("Rotation keyframes randomized between -180° and +180°");
} else {
alert("Selected layer has no rotation keyframes.");
}
} else {
alert("Please select a layer.");
}
} else {
alert("Please select a composition.");
}
}