Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression driven comp severly affecting performance! Advice Please!

  • Expression driven comp severly affecting performance! Advice Please!

    Posted by Tom Holmes on July 18, 2014 at 9:32 am

    Hey guys!

    I’m creating a calendar animation that will be driven by expressions. These expression are based on the source text of text layers in another comp. These text layers will be populated based on an external spreadsheet. With me so far?

    So by manipulating the text values in the ‘Data’ comp, the animation can zoom to particular days on the calendar and highlight certain weeks etc.

    Now everything works fine, except the comp is PAINFULLY slow. Is there any optimizations i can do increase performance… there are alot of expressions over the 5 or 6 comps that all work together but not a ridiculous amount. Im having to wait 3 or 4 seconds for the view to update when moving the play-head… and i know its not the graphics because they are very basic and it just as slow on quarter quality than it is on full.

    Why is my project taking such a performance hit?!

    Thanks guys!

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

    July 18, 2014 at 4:03 pm

    Are you using sampleImage() expressions to locate the extents of the text? If so, that’s probably the source of your performance problems. If you’re using a script to update the text, you might as well have it harvest whatever text extents you need at that time (scripts can do that very efficiently) and ditch the sampleImage() stuff.

    Dan

  • Tom Holmes

    July 20, 2014 at 12:57 pm

    Hey Dan, thanks for your response!

    I’ve not use sampleImage() even once. Its mostly if/ else statements through the entire thing. parameters (mostly opacity and position) are determined by the source text of a text layer. I don’t have the aep files with me right now so i can give you can example of the expressions. but i can try to explain one example.

    I have a calendar page, June for instance. i need to be able to zoom into any particular date on that calendar. So i have a null object which is positioned on the date cell that i need to zoom into (e.g. 5th). The position of the null has an expression to position itself based on the source text of a text layer located in another comp. So if a the value of said text layer is “b2” for instance, the null would position itself on the corresponding cell on the calendar. This would allow the zoom in position to be controlled based on what the source text reads. Id be surprised if I’ve explained this well enough for you to understand, but basically the whole project is controlled in this way. There is highlight and other things that are also driven in the same way… like i said everything work exactly how i want it but everything is soooooo slow!

    does this make sense?

    Thank for you’re help dan, you’re always my go-to guy for expressions! 🙂

    Tom

  • Dan Ebberts

    July 20, 2014 at 4:03 pm

    Parsing text from text layers is another thing that seems to slow everything down if you have enough expressions doing that. What are you using to set the text? It might be helpful to see one of your null expressions.

    Dan

  • Tom Holmes

    July 24, 2014 at 4:08 pm

    Hi Dan, heres a quick example of my expression.

    I have a calendar, and based on what the date range is in two text fields (start date, end date) in comp ‘Data Fields’ (date has been converted into slider values, 0 means it isn’t in the date range, 1 means it IS in the date range, and 2 means its in another specified date range), the specific cells highlight(fill) when another slider controller is animated from 1 to 100.

    The expression set to all 31 cells… (shape layer’s ‘Fill’ parameter:

    nn=thisLayer.name.replace(‘c’,”);
    if(comp(“Data Fields”).layer(“Calendar 1”).effect(nn)(“Slider”)==1)

    linear(thisComp.layer(“Highlight Fade-On”).effect(“Highlight 1”)(“Slider”), 0,100, comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Calendar Cells”)(“Color”),comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Highlight Colour 1”)(“Color”))

    else

    if(comp(“Data Fields”).layer(“Calendar 1”).effect(nn)(“Slider”)==2)
    linear(thisComp.layer(“Highlight Fade-On”).effect(“Highlight 2”)(“Slider”),0,100,comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Calendar Cells”)(“Color”),comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Highlight Colour 2”)(“Color”))

    else

    comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Calendar Cells”)(“Color”)

    The numbers on the cells have an expression on their ‘Fill’ properties which will chance the colour of the text as the cell shape changes (so its more noticeable) This is applied to all 31 number layers:

    nn=thisLayer.name.replace(‘n’,”);

    if(comp(“Data Fields”).layer(“Calendar 1”).effect(nn)(“Slider”)==1)

    linear(thisComp.layer(“Highlight Fade-On”).effect(“Highlight 1”)(“Slider”),0,100,comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Text_Colour_Normal”)(“Color”),comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Text_Colour_Highlighted”)(“Color”))

    else

    if(comp(“Data Fields”).layer(“Calendar 1”).effect(nn)(“Slider”)==2)

    linear(thisComp.layer(“Highlight Fade-On”).effect(“Highlight 2”)(“Slider”),0,100,comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Text_Colour_Normal”)(“Color”),comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Text_Colour_Highlighted”)(“Color”))

    else

    comp(“Data Fields”).layer(“Adjustment Layer 2”).effect(“Text_Colour_Normal”)(“Color”)

    If you can make sense of my patchy explanation, do you have any advice on how i can optimize this expression. There is ALOT of repeat expressions.

    Thanks!

  • Dan Ebberts

    July 24, 2014 at 4:51 pm

    It looks like you have a lot of cross-comp expressions that have to be evaluated on every frame, even though (I’m guessing) the info in the Data Fields comp probably doesn’t change once the user sets it up. If it were me, I’d set the UI up as a script with a Build button to set the calendar up based on the data in the UI. Good news-it should be blazingly fast; bad news–it will take some effort to create the script. I’d be especially inclined to go the scripting route if you’re building this for someone else to use.

    Dan

  • Tom Holmes

    July 25, 2014 at 8:26 am

    Hi Dan, thanks for the advice…

    The plans is to run the CompsFromSpreadsheet script to generate the multiple thousand variations of date ranges.

    It would be awesome to use a script but i haven’t the first clue on how to write scripts.

    what do you advise?

    :/

  • Dan Ebberts

    July 25, 2014 at 5:26 pm

    I think it would be an ambitious (but do-able) first scripting project, but it will take some time to get up to speed. Or, find someone that can do it for you.

    Dan

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