Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is there a way to simplify this line of code

  • Is there a way to simplify this line of code

    Posted by Chris Forrester on March 23, 2013 at 12:38 pm

    Hi all I have been playing around with some ideas and was looking for some advice on simplifying this piece of code (well expression)

    this is what I started of with

    a=transform.position,
    b=thisComp.layer("MainSquare").content("Rectangle 1").content("ResizingGroup").transform.scale,
    c=(a*b)/100

    Which gave me this error

    Bad method arguments: one argument to mul() must be a scalar

    So I broke it down into this and it works.

    a=transform.position,
    b=thisComp.layer("MainSquare").content("Rectangle 1").content("ResizingGroup").transform.scale,
    c=[a[0]*b[0],a[1]*b[1]]/100

    Is there a nicer way to accomplish the same thing without breaking it into each individual dimension.

    Any other advice regarding math on vectors is also very welcomed.

    Thanks in advance

    Regards
    Chris Forrester
    demoreel http://www.chrisforrester.tv

    Dan Ebberts replied 13 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 23, 2013 at 4:56 pm

    That’s pretty much how I would do it, unless you know that the scale is uniform (same for x and y), then you could do this:

    c =a*b[0]/100

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy