Search code examples
svgafter-effects

Programmatic control -- large number of elements


I am fairly new to AE. I am aware of JS expressions. I have a programming background.

I have the following type of data that I want to visualise.....

I have about 10,000 different elements (locations in a city). Each of these elements occur during the last 10 years (I will compress this into 60 seconds).

When each element occurs..I want a small sphere to appear. This sphere will occur somewhere in the X,Y space (depending on its lattitude and longitude).

To provide some context ... the data is a series of house sales. The larger the price of the sale...the larger the sphere....

Becuase of the large number of elements. It is not possible (nor desirable) to manually do this in AE.

So...my question is....how can I programmatically do this in AE...?

Is it possible...?

Or perhaps should I write a program to automatically create some type of SVG that I could then import into AE...?

Or another approach entirely...?

Any ideas ... on a basic approach would be welcome.

Thanks,

Mark


Solution

  • Q1: So...my question is....how can I programmatically do this in AE...?

    A1: You can use the ExtendScript API to run a Javascript that creates your elements.

    Q2: Is it possible...?
    A2: Yes.

    Q3: Or perhaps should I write a program to automatically create some type of SVG that I could then import into AE...?
    A3: You can't import SVG into AE (as far as I know).

    Q4: Or another approach entirely...?
    A4: No. You are in the right spot (IMHO).

    You could use my two scripts (Warning: shameless self promotion) for creating maps and location markers in an AE comp.

    To add the price/size to your sphere you need to do some additional scripting. I suggest hacking on Locations for that.

    The function add_projected_marker in line 1814 should be a good entrypoint to add additional expressions to you newly created layer.
    You could add an expression like this to the scale property (where v is the value you read from your csv):

    layer.transform.scale.expression = "var v = 50;\n[v,v];"
    

    To get the data into the the locdata object you need to hack on the function win.read_button.onClick in line 1181.