ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Animating chart data from json - from 0 to json value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Otto Tasnadi
Animating chart data from json - from 0 to json value
on Jul 28, 2020 at 12:09:20 pm

I have a chart that uses data from a json array.
I have the next code on a position to calculate X position:

var X = parseInt(thisComp.layer("X-1").text.sourceText);
var X_max = parseInt(thisComp.layer("X_max_value_mo_1").text.sourceText);
var X_min = parseInt(thisComp.layer("X_min_value_mo_1").text.sourceText);
linear(X,X_min,X_max,thisComp.height-50,50);


Any ideas on how to animate this on the timeline from 0 up to this number? I want to animate the chart to grow the values from X_min to X.
I think I need to have two keyframes and to add some code for each one?
Can anybody help me?

Thanks!

var X = parseInt(thisComp.layer("X-1").text.sourceText);
var X_max = parseInt(thisComp.layer("X_max_value_mo_1").text.sourceText);
var X_min = parseInt(thisComp.layer("X_min_value_mo_1").text.sourceText);
linear(X,X_min,X_max,thisComp.height-50,50);


Return to posts index

Filip Vandueren
Re: Animating chart data from json - from 0 to json value
on Jul 28, 2020 at 1:06:43 pm

I'm guessing you still need to do that first interpolation in your example ?

You can always use an extra linear() controlled by a slider from 0-100.
Like this:


var X = parseInt(thisComp.layer("X-1").text.sourceText);
var X_max = parseInt(thisComp.layer("X_max_value_mo_1").text.sourceText);
var X_min = parseInt(thisComp.layer("X_min_value_mo_1").text.sourceText);

var lin = linear(X,X_min,X_max,thisComp.height-50,50);

sl = thisComp.layer("Null 1").effect("Slider Control")("Slider").value;

linear(sl, 0, 100, X_min, lin);




Return to posts index

Otto Tasnadi
Re: Animating chart data from json - from 0 to json value
on Jul 29, 2020 at 5:32:29 am

Thanks a lot, It works like a charm (with small customization)!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]