-
Trying to write a script to add a wiggle expression with values via text boxes
I’m trying to automate adding a wiggle expression via a script. I want text boxes to pop up to enter the freq and amplitude of the wiggle. So far I have this:
{//Set Undo Group
app.beginUndoGroup("Wiggle");wiggleFreq = parseFloat(prompt("Frequency"));
wiggleAmp = parseFloat(prompt("Amplitude"));var myItems = app.project.selection;
for (var i = 0; i < myItems.length; i++) {
if (myItems[i] instanceof CompItem) {
myItems[i].layer(1).property("Position").expression = "wiggle(effect(wiggleFreq),effect(wiggleAmp))";
}
}app.endUndoGroup();
}The text boxes work but I can’t figure out how to get the info from the boxes to actually get added to the expression. I get an error every time and it adds the broken wiggle expression. I’ve tried a few things but I’m out of my depth here.
Also I’d love to be able to add the wiggle to any selected property not just position but I’m not sure how to write that code.
Any ideas?