// Isosceles_RandomizeRotation.jsx
// Code generated by ChatGPT-4o
// Date: June 18, 2025
// Description: This After Effects script will randomize all rotation keyframes of 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.");
    }
}
