javascript - 如何使用 Lottie web 访问预合成中的文本数据
问题描述
我正在尝试控制使用 bodymovin 导出的 .json 文件的文本值。
此刻,我成功地创建了一个从 bodymovin 导出的平面“模板”,并使用函数 updateDocumentData 更改了 bodymovin .json 文件中的值。
但我唯一可以更改的元素是 After Effects 主要组成中的元素。现在我想尝试制作一个更难的模板,在 After Effects 中使用预合成。我如何使用 updateDocumentData (或其他函数?)来更改更深层组合中的文本值。
function functionUpdate() {
anim.playSegments([450, 460], true);
const animElement = anim.renderer.elements[1];
console.log(anim.renderer.elements[1])
animElement.updateDocumentData({t: 'Test Text'});
}
const animData = 'js/data_test.json';
const animContainer = document.getElementById('lottie-container');
const anim = lottie.loadAnimation({
container: animContainer, // The dom element that will contain the animation
renderer: 'svg',
loop: false,
autoplay: false,
path: animData // Path to the animation json
});
解决方案
推荐阅读
- go - 如何使用 go-guardian JWT 策略主动注销用户?
- wordpress - WooCommerce:创建产品页面而不是使用产品过滤器
- amazon-web-services - CMD 上是否有命令通过无服务器框架列出 AWS 上的所有部署 lambdas(Functions)?
- c - 在 C 中比较两个字符串的问题
- node.js - NodeJS 中的异步 foreach 或 for 循环
- javascript - 我的应用程序可以更改用户的浏览器设置吗?
- datagrip - Datagrip - 无法启动
- ios - Swift - 放置正确的导航箭头方向
- javascript - onbeforeunload 事件确认
- javascript - 如何用更多跨度标签包装html跨度标签数组?