ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

"must be scalar" error

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dagur Maunason
"must be scalar" error
on May 27, 2019 at 2:06:06 pm

Hi all,

I'm trying to have a layers scaling follow a Slider control, which works just fine, even with a time offset for the child layers in point implemented. The last functionality I want is to multiply the incoming value from the master with whatever value the child was originally set to, so that the processed animation ends up at for example 80%, instead of 100%. When I input the solution below I get an error stating "one argument to mul() must be scalar". I've tried to searching for an answer but to no avail.

Any help would be greatly appreciated!

offset = thisLayer.inPoint;
orgValue = transform.scale;
animValue = thisComp.layer("Anim Master").transform.scale.valueAtTime(time - offset);
newValue = orgValue*animValue;
newValue


Return to posts index

Dagur Maunason
Re: "must be scalar" error
on May 27, 2019 at 2:28:53 pm

I just managed to finally hack a solution together that works, but if anyone know a cleaner/smarter way to do this please enlighten me! And also to know how to do this for example for a 3d layers position would be awesome aswell ☺

Cheers!

offset = thisLayer.inPoint;
orgValueDiff = 100-transform.scale;
animValue = thisComp.layer("Anim Master").transform.scale.valueAtTime(time - offset);
newValue = animValue-orgValueDiff;
[newValue[0], newValue[1]-100]


Return to posts index

Tomas Bumbulevičius
Re: "must be scalar" error
on May 28, 2019 at 2:48:06 pm

Dagur - for 3D, you just need to add another dimension, with an array index of 2.


[newValue[0], newValue[1]-100, newValue[2]]

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index


Dagur Maunason
Re: "must be scalar" error
on May 29, 2019 at 3:18:28 am

Thank you Tomas!


Return to posts index

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