Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Data Driven Animation: get Color from Json

  • Data Driven Animation: get Color from Json

    Posted by Alex Weil on June 11, 2018 at 4:30 pm

    Hey folks

    i have a color in my Json file

    {
    "textcolor": "[255,0,255,255]"
    }

    now in my footage i got the “textposition” field with an expression on it. how do i get the color informations out of it and apply it to a fill effect on a different Layer?

    cheers
    Alex

    Alex Weil replied 7 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 11, 2018 at 10:21 pm

    I can’t exactly picture what you’re describing, but if you import your json file, you could then use something like this on the color property:

    data = footage(“your_json_file.json”).sourceData;
    eval(data.textcolor)/255

    Note that if you had your color data as an array instead of a string, like this:

    {
    “textcolor”: [255,0,255,255]
    }

    you could eliminate the eval() in the color expression:

    data = footage(“your_json_file.json”).sourceData;
    data.textcolor/255

    Dan

  • Alex Weil

    June 12, 2018 at 7:41 am

    sorry, had some little failures in my text … sorry, i meant “textcolor”

    i tried to say, that i only have an expression on the layer, that says “footage(“test9.json”).dataValue([9])” but there was no data that i can use to pick my color from.

    thanks to your answer, i erased the quotation marks from the array and now i got some nice usable data ☺
    thanks dan

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