ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

setValueAtTime function doesn't exist

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrzej Supermocny
setValueAtTime function doesn't exist
on Sep 5, 2018 at 6:07:41 pm

I'm importing a json, and I want to animate the x and y values of a Null's position. I get an error saying the setValueAtTime function doesn't exist, sometimes it's not defined. I've lost my sanity over this I don't remember anymore. I was looking in the Scripting Docs and I put in this function but this just doesn't seem to work no matter what. Created an account for this.

The expression resides in the position value of a Null:

recording = footage("json.json").sourceData;
Y = recording.Y;
lastId = recording.lastId;
taim = 0;

for (id = 0; id &lt;= lastId; id++) {
x = recording[id][0];
y = recording[id][1];
setValueAtTime(taim, [x, y]); // ERROR: setValueAtTime is undefined
taim = taim + Y;
}


Return to posts index

Dan Ebberts
Re: setValueAtTime function doesn't exist
on Sep 5, 2018 at 7:02:13 pm

You can use setValueAtTime() in a script, but not an expression.

Dan



Return to posts index

Andrzej Supermocny
Re: setValueAtTime function doesn't exist
on Sep 5, 2018 at 8:34:30 pm

Thanks. I've tried implementing this in a script but I hit another roadblock when I found out than I can't get the json file by name from the Project panel, only by index and some id property. Is this correct? Would I need to create a UI with an import dialogue box or drag and drop functionality?

Thanks again.


Return to posts index


Dan Ebberts
Re: setValueAtTime function doesn't exist
on Sep 5, 2018 at 9:17:32 pm

For a script to find something by name in the project bin, you have to loop through the items, until you find an item with the correct name and of the correct type (FootageItem, I'm assuming). Then using the item's .file attribute, you should be able to read the source file. I haven't tried it (recently at least), but it sounds reasonable.

Dan



Return to posts index

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