Created
June 10, 2020 04:10
-
-
Save seblavoie/05b85ae6ac4cc6c61fc9718a871f1294 to your computer and use it in GitHub Desktop.
next.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The action to be performed. Next is 1, Prev is -1. | |
concat = 1; | |
activeComp = app.project.activeItem | |
// Propery is selected | |
if(activeComp.selectedProperties.length > 0) { | |
updateProperties() | |
} | |
// First layer has Frame | |
else if(activeComp.layer(1).Effects.property("Frame") != null) { | |
property = activeComp.layer(1).Effects.property("Frame") | |
setPropertyValue(property.property("Slider")) | |
} | |
// Update bouche | |
else { | |
updateBouche() | |
} | |
// function update | |
function updateBouche() { | |
var controllerLayer = esy.composition.first(activeComp, "Controller") | |
var bouche = controllerLayer.Effects.property("Bouche") | |
if(bouche) { | |
setPropertyValue(bouche.property("Slider")) | |
} | |
} | |
function updateProperties() { | |
var selectedProperties = activeComp.selectedProperties | |
for (var i = 0; i < selectedProperties.length; i++) { | |
updateProperty(selectedProperties[i]) | |
} | |
} | |
function updateProperty(property) { | |
if(property instanceof PropertyGroup) { | |
setPropertyValue(property.property("Slider")) | |
} | |
} | |
function setPropertyValue(property) { | |
var value = property.value + concat | |
if(property.numKeys > 0) { | |
property.setValueAtTime(activeComp.time, value) | |
key = property.nearestKeyIndex(activeComp.time) | |
// Set keyframe to hold if previous one is hold | |
if(key - 1 > 0) { | |
if(property.keyInInterpolationType(key - 1) == KeyframeInterpolationType.HOLD) { | |
property.setInterpolationTypeAtKey(key, KeyframeInterpolationType.HOLD); | |
} | |
} | |
} else { | |
property.setValue(value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment