Debug After Effects Expressions in console.log (sort of)
How to find the value of a variable quickly and easily.
When writing complex code, (such as Javascript expression in Adobe After Effects), it is often helpful to be able to see what a variable’s value is. If you were using javascript in an HTML web page, you could send these values to the browser’s Developer Console, using the simple code console.log(). Unfortunately, After Effects does not have the equivalent of a developer console. It does have the info panel, but you can only interact with that when writing a script. For a regular expression (or even an irregular one), I used to use a text layer and edit the sourceText to show the variable. But this was time consuming and not always easy – and quite often, it was confusing.
Instead, a much simpler approach is to throw an error. Using just the code below, the expression halts, After Effects highlights the issue and you can see the value of whatever you ask.
throw new Error( VARIABLE )
or even simpler, just:
throw VARIABLE
Related COW Tutorials
###
Enjoying this tutorial? Sign up for the Creative COW Newsletter!
Sign up for the Creative COW newsletter and get weekly updates on industry news, forum highlights, jobs, inspirational tutorials, tips, burning questions, and more! Receive bulletins from the largest, longest-running community dedicated to supporting professionals working in film, video, and audio.
Enter your email address, and your first and last name below!
Responses