Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions switch() difficulty

  • switch() difficulty

  • Jean Piche

    September 9, 2021 at 5:24 pm

    Don’t quite know what is wrong. This expression simply doesn’t work. It aims to set a Tumble parameter depending on a series of choices that live in a Dropdown menu expression controller. The value of the dropdown does carry through, but the switch(xx) and case statements do not work at all. Here is the expression:

    xx = thisComp.layer(“OFFSET”).effect(“FLIP MODE”)(“Menu”);

    var jjj = 0

    switch(xx){

    case 1: jjj =0; break;

    case 2: jjj =10; break;

    case 3: jjj =30; break;

    case 4: jjj =50; break;

    case 5: jjj =90; break;

    case 6: jjj =130; break;

    case 7: jjj =180; break;}

    jjj;

    Any ideas? Many thanks!

  • Fabrice Leconte

    September 9, 2021 at 6:04 pm

    Hello, line 1, convert the string to a number.

    xx = Number(thisComp.layer('OFFSET').effect('FLIP MODE')('Menu'));

    var jjj = 0

    switch(xx){

    case 1: jjj =0; break;

    case 2: jjj =10; break;

    case 3: jjj =30; break;

    case 4: jjj =50; break;

    case 5: jjj =90; break;

    case 6: jjj =130; break;

    case 7: jjj =180; break;}

    jjj;

Viewing 1 - 2 of 2 posts

Log in to reply.

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