jQuery in After Effects

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
rochre
Posts: 1
Joined: January 25th, 2014, 1:36 pm

January 27th, 2014, 4:18 pm

Hello. I'm new to javascript but not ae. I'm experimenting with a scripting project that involves reading csv data and it looks like there is a function already available in jQuery so the question is can I use jQuery in AE? Are there problems with doing this?
chriskelley
Posts: 4
Joined: August 1st, 2012, 5:22 pm

April 17th, 2014, 7:07 pm

You probably won't have much luck using any of jQuery in AE, I haven't tried it but I imagine many of the constructors will fail and the majority of the library won't load. jQuery exists for DOM manipulation in web browsers, and won't know what to do in AE.

You can load other libraries and use them though - I have used underscore.js in my AE scripts for map/reduce implementations with no problem. You would have to use a library that is not dependent on the DOM - javascript is not tied to the DOM, it just so happens that many client-side JS libraries exist to directly manipulate it. You'll need to look around a bit to see what is out there, but you'd probably have better luck digging through some node.js modules since they run on the server side.

To load external libraries just include them at the top of your script with:

Code: Select all

#include './path/to/your/lib/underscore.js'
All that said, CSV reading and manipulation is very straightforward in javascript, and therefore AE - what exactly are you trying to do?



p.s. - I have mulled over starting an open source "jQuery-esque" library for AE to make it more accessible... anyone around here have thoughts? Imagine:

Code: Select all

$("assemble_comp").layers.each(function(){ this.transform.position = [random() * 100, random() * 100, random * 100]; });
Post Reply