How can i get access to methods? Please help

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
rook2pawn
Posts: 5
Joined: January 15th, 2008, 10:29 pm

Im trying to write all my code in a jsx, but im getting tied up trying to use expressions when i can't figure out how to properly do it without an expession.

sometimes i want to use a method like timeToFrames or maybe the function linear. but when i work in my jsx file i think there is scoping problems.


here is my code it basically swings a picture in the middle back and forth



var myComp = app.project.activeItem;
if (myComp == null || !(activeItem instanceof CompItem)){
alert("Please establish a comp as the active item and run the script again");
} else {

var centerWidth = myComp.width/ 2;
var centerHeight = myComp.height / 2;
var plusWidth = 0;
var plusHeight = 0;


myComp.layer('Knut_IMG_8095.jpg').property("position").setValueAtKey(1, [centerWidth + plusWidth, centerHeight + plusHeight]);


for (var x = 1; x <= myComp.workAreaDuration; x++)
{
plusWidth = centerWidth*Math.sin(x*0.3);
myComp.layer('Knut_IMG_8095.jpg').property("position").setValueAtTime(x,
[centerWidth + plusWidth, centerHeight + plusHeight]);
}





So that is to give you idea im just learning this. i want to access a function say like "linear" how can i get access to something like linear?

Also is there code i can write that will be evaluated on a per After Effect "cycle" the way it happens when you write expression code say inside the position box? but externally? It seems that all a JSX can do is evaluate before the playback begins, so you won't have real-time access to real-time variable? Is this correct? :-(
please help clarify! :oops: :oops:
Post Reply