airbnb / lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
MIT License
30.65k stars 2.89k forks source link

ActionScript error #269

Open jcmidia opened 7 years ago

jcmidia commented 7 years ago

Hello! I have an animation that get data from an excel table and generate some graphs. Is is possible to do something similar to exports in HTML using Bodymovin? Because I've tried to export and it gives the follow error Uncaught ReferenceError: $ is not defined at s.eval (eval at initiateExpression. It's probably because the action script doesn't run in HTML. Is there other way to get data from a external file, like a json, and populate the HTML animation?

bodymovin commented 7 years ago

where do you use that method? inside of Flash? You can change the JSON data with new values, but you need to find the position in the JSON object where to update them. A JS method shouldn't be too hard to develop.

jcmidia commented 7 years ago

But the eval function is just one that is given error. There are some other action script functions that are not working after Bodymovin exporting.

Take a look at this. There are some effects functions given error too, like this "x":"var $bm_rt;\nvar InputVal, ChartMax, AnimationCompletion, ratio, Length;\nInputVal = div(effect('Bar Value')('Deslizador'), 100);\nChartMax = thisComp.layer('Chart Controls').effect('Max Value')('Deslizador');\nAnimationCompletion = effect('Percentage')('Deslizador');\nratio = div(AnimationCompletion, ChartMax);\nLength = 100;\n$bm_rt = mul(mul(mul(InputVal, Length), thisComp.frameDuration), ratio);"

Do you think it is possible to convert all the action scripts code to javascript?

data.json.zip

bodymovin commented 7 years ago

I see the animation breaking here:

var $bm_rt;try {    $bm_rt = comp1[1];} catch (err) {    $bm_rt = 'not found';}

what is "comp1"? is this exported from AE or are you editing it afterwards?

jcmidia commented 7 years ago

It was exported. But if you change this by $bm_rt = 20; for example, it will give another error. The problem is not just the comp1 variables. I think the action script can't be exported by Bodymovin.

bodymovin commented 7 years ago

AE's expressions are not Actionscript, they are closer to Javascript. Bodymovin supports a lot of expressions, but it's a WIP. If you can share the project I can take a look at what is not supported and see if I can include it.

jcmidia commented 7 years ago

The comp1 is a variable inside the Libro8.prn. You should change the path of the Libro8.prn file in the After Effects to work.

Archive.zip

bodymovin commented 7 years ago

I see, you're using evalFile inside an expression I'll see this as an enhancemente for the future.

jcmidia commented 7 years ago

Nice, It would be great! Thanks

ReneBrainstud commented 6 years ago

Any updates on when 'evalFile' will be implemented? It would open a lot of possibilities on data driven animations! i'll have to use a javascript workaround to load a .json file for now :(