Awesome tool!
Is there a way to shift the time of keyframes dynamically? Inside of after effects I was able to accomplish this with something like valueAtTime(time-2), but is there a way to make that 2 dynamic so that we can provide that value while loading the animation?
Would I have to overwrite a property with something like var $bm_rt;\n$bm_rt = valueAtTime($bm_sub(time, 2));?
Hello, maybe reference the 2 as the value of a slider control within AE, rerender with the new expression, and then use lottie-api.js to change the value of this layer.effect on launch?
Good thinking. I'll give that a try. Thanks!
I'm trying to implement this following the example file:
var mousePosition = [0,0]
animationAPI = lottie_api.createAnimationApi(anim);
var positionProperty = animationAPI.getKeyPath('red_solid,Transform,Position');
animationAPI.addValueCallback(positionProperty, function(currentValue) {
return mousePosition;
});
I'm not understanding how this is working. Is the property value supposed to change whenever the mousePosition value changes? Also, how does the 'red_solid,Transform,Position' change if the target layer is inside of a preComp? I can't seem to target my property.
Yes, if you update the mousePosition value it will be picked up by the method you are passing to addValueCallback.
Regarding precomps you should add the precomp layer name as part of the path. Something like:
'Precomp Name,red_solid,Transform,Position'
Great, thank you. How do you target a text layer's Source Text property to change the text? I can't seem to get it to work.
Not sure if this is still up to date:
https://github.com/airbnb/lottie-web/wiki/TextLayer.updateDocumentData
There may have been a more recent Issue filing that solved this with an updated solution, I'd search the Issues here too
Most helpful comment
Hello, maybe reference the 2 as the value of a slider control within AE, rerender with the new expression, and then use lottie-api.js to change the value of this layer.effect on launch?