FORUMS: list search recent posts

Script to set a Keyframe at current time

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Oscar Gomez
Script to set a Keyframe at current time
on Nov 1, 2017 at 11:51:43 pm

Hi all! I need some help creating a script to add a keyframe on a selected layer.

I already have one that works but this only works for position, rotation, scale or opacity. I need this script to add the keyframe on a slider control in the selected layer called HandShape.

Here's the script I got:

var MyComp = app.project.activeItem;
if(MyComp && MyComp.selectedLayers.length > 0){
for(var i = 0 ; i < MyComp.selectedLayers.length; i++){
var currentLayer = MyComp.selectedLayers[i];
currentLayer.property(myProperty = "rotation").setValueAtTime(MyComp.time,myValue = 5);
};
}else{
alert("At least one layer must be selected");
};


Thanks for taking the time to read this, hopefully someone out there can solve it!


Return to posts index

Walter Soyka
Re: Script to set a Keyframe at current time
on Nov 2, 2017 at 4:54:53 pm

Try this:

var MyComp = app.project.activeItem;
if(MyComp && MyComp.selectedLayers.length > 0){
for(var i = 0 ; i < MyComp.selectedLayers.length; i++){
var currentLayer = MyComp.selectedLayers[i];
currentLayer.effect("HandShape")("Slider").setValueAtTime(MyComp.time,myValue = 5);
};
}else{
alert("At least one layer must be selected");
};


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Oscar Gomez
Re: Script to set a Keyframe at current time
on Nov 2, 2017 at 10:56:18 pm

Walter Soyka, you are amazing!

Thank you so much for taking the time to solve this. This is going to be a HUGE time saver on the project I'm working on!

Cheers,
Oscar


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]