Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Array piece can’t expand to more than one value Error, please heelp!

  • Array piece can’t expand to more than one value Error, please heelp!

    Posted by Alejandro Ubaldo Morales on October 25, 2023 at 1:17 pm

    I am trying to follow an AE tutorial to learn code from zero, at the exercise in minute 30, we need to make a circle (elipse path) color red if the X Position value is greater than 960, but the code i am copying from the video is not working giving me that error, i would appreciate any help for this beginner, here is my code:

    1. var red = [215,68,63,255] / 255;
    2. var black = [51,58,55,255] / 255;
    3. if(transform.xPosition > 960) [

    red

    ]

    else [black] I am using AE version 2023, and the tutorial is from 2021, i don’t know if that has anything to do with this issue.

    Here is the link to the tutorial: https://www.youtube.com/watch?v=Knp2S_gs-Rc

    Alejandro Ubaldo Morales replied 2 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Walter Soyka

    October 25, 2023 at 6:41 pm

    In Javascript, square brackets indicate arrays (lists) and curly braces indicate blocks of code (such as would follow an if/else statement. You are using square brackets where you should be using curly braces.

    Try this:

    var red = [215,68,63,255] / 255;
    var black = [51,58,55,255] / 255;
    if (transform.xPosition > 960) {
    red;
    } else {
    black;
    }
  • Alejandro Ubaldo Morales

    October 25, 2023 at 11:12 pm

    In the Tutorial he uses […] instead of (…) and it works, i wonder why.

    Anyways you saved me, thank you so much!!!

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