Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with invalid expression

New Here ,
Jun 26, 2011 Jun 26, 2011

In the book by Marcus Geduld "AfterEffectsExpressions" there is an example (p.145) that reads:

effect("4-Color Gradient").param(propertyIndex - 2).valueAtTime(time - .5)

This is an expression applied to one of the points in a 4-Color Gradient effect. It returns an error message:

Bad method arguments: propertyIndex can't be used in this Property. It seems odd that this book has a whole section that uses this expression that is apparently not valid.

BTW I have found a number of typos in the book which otherwise I enjoy and have learned plenty from. I would contact him if there was some link in his book but I find none.If someone can figure this one out I would really appreciate it.

TOPICS
Expressions
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 26, 2011 Jun 26, 2011

I think the problem is that when the book was written, thisProperty was implied when referring to attributes of the property housing the expression. Somewhere along the line it was changed so that now you have to explicitly include it. This should work:

effect("4-Color Gradient").param(thisProperty.propertyIndex - 2).valueAtTime(time - .5)

Dan

Translate
Community Expert ,
Jun 26, 2011 Jun 26, 2011

I think the problem is that when the book was written, thisProperty was implied when referring to attributes of the property housing the expression. Somewhere along the line it was changed so that now you have to explicitly include it. This should work:

effect("4-Color Gradient").param(thisProperty.propertyIndex - 2).valueAtTime(time - .5)

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 26, 2011 Jun 26, 2011

Dan, right on, thank you for the quick response. It works like a charm. I wonder how many more things like that have changed in the last 2-3 years (the book seems to be from 2008-9) Any reccomendations as to a more up-to-date book on the subject?

thanks a mil

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2011 Jun 26, 2011
LATEST

Off the top of my head, the only other thing I can think of that has changed that would cause old expressions to break in newer versions of AE is that at some point  (I forget which version) the hack to read a text file using #include stop working and now requires $.eval() instead.

As far as I know, Marcus's book is the only one dedicated to expressions. I don't know if he's planning an update.

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines