ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Illegal use of reserved word 'if'

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ollie ChaterIllegal use of reserved word 'if'
by on Jan 9, 2017 at 6:18:41 pm

I'm trying to alter the x position of a layer based on various checkboxes using If/Else statements.

However, i am receiving this error message:



Any and all help is greatly appreciated!

- Ollie

charging = if (comp("iOS 10").layer("Status Bar").effect("iOS Controls")("Charging")==1) 20 else 0;
percentage = if (comp("iOS 10").layer("Status Bar").effect("iOS Controls")("percentage")==1) 50 else 0;

x = 540 + charging + percentage;
y = 30;

[x,y]


Return to posts index

Dan EbbertsRe: Illegal use of reserved word 'if'
by on Jan 9, 2017 at 8:59:21 pm

I think your syntax isn't quite right. This might work better (I haven't tested it though):


charging = comp("iOS 10").layer("Status Bar").effect("iOS Controls")("Charging")==1 ? 20 : 0;
percentage = comp("iOS 10").layer("Status Bar").effect("iOS Controls")("percentage")==1 ? 50 : 0;

x = 540 + charging + percentage;
y = 30;

[x,y]




Return to posts index

Ollie ChaterRe: Illegal use of reserved word 'if'
by on Jan 9, 2017 at 9:40:10 pm

Thanks Dan - works perfectly!


Return to posts index

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