Skip to main content
Known Participant
March 31, 2023
Answered

CSV Data Driven with Ease Ease

  • March 31, 2023
  • 1 reply
  • 1281 views

Hello.

 

I have a CSV in AE that has 5 columns, each with 11 rows of data written as a percentage.

 

I have 5 shape layers (bar graphs) in my comp.

 

Can you please help me create an expression that controls the height (using the y scale %) of my shape layers according to the percentage in the row?

 

The tricky bit I’m finding is I need it to pause on each row for 1 second, then easy ease into the next row, pause etc…

 

So when I play it back, the 5 bars are going up and down depending on the percentage in that given year.

 

It would be good if it was possible to control the duration of the pause, and easy ease transition between each data point.

 

I started with this, but I’m running into all sorts of errors.

 

x = 100;
y = footage("Test2.csv").dataValue([0,timeToFrames(time,.5)+1]);
[x,y]

 

Thank you for any guidence! 

This topic has been closed for replies.
Correct answer Dan Ebberts

Your data file has a problem in that it doesn't have a heading for the first column. Once I fixed that, this seems to work:

myCol = 1;
hold = 1;
numRows = 11;
t = Math.min(Math.floor(time/hold),numRows-1);
tNext = Math.min(t+1,numRows-1);
pct = time%hold;
curDat = parseFloat(footage("Data.csv").dataValue([myCol,t]));
nextDat = parseFloat(footage("Data.csv").dataValue([myCol,tNext]));
y = ease(pct,0,hold,curDat,nextDat);
[value[0],y]

Each shape layer would have different number in the first line (which you might be able to determined from the name of the shape layer), and the second line defines the pause time between values.

 

1 reply

ShiveringCactus
Community Expert
Community Expert
March 31, 2023

Can you post an example of your CSV - it'll be easier than recreating from scratch to test the code out.

Known Participant
March 31, 2023

Thank you for replying. I've attached the data csv.

 

Let me know if you think it's possible.

 

Thanks again.

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
March 31, 2023

Your data file has a problem in that it doesn't have a heading for the first column. Once I fixed that, this seems to work:

myCol = 1;
hold = 1;
numRows = 11;
t = Math.min(Math.floor(time/hold),numRows-1);
tNext = Math.min(t+1,numRows-1);
pct = time%hold;
curDat = parseFloat(footage("Data.csv").dataValue([myCol,t]));
nextDat = parseFloat(footage("Data.csv").dataValue([myCol,tNext]));
y = ease(pct,0,hold,curDat,nextDat);
[value[0],y]

Each shape layer would have different number in the first line (which you might be able to determined from the name of the shape layer), and the second line defines the pause time between values.