From 168317de4c903f52063c5d6938361f9dd3cb4c6c Mon Sep 17 00:00:00 2001 From: SamuelOsborne Date: Fri, 4 Mar 2022 12:14:36 +0100 Subject: [PATCH] Updated README Updated information on loading animations pragmatically. --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d96ffdc..d5532ef 100644 --- a/README.md +++ b/README.md @@ -88,12 +88,14 @@ You may set and load animations programatically as well. ```js const player = document.querySelector("lottie-player"); -player.load("https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json"); - -// or load via a Bodymovin JSON string/object -player.load( - '{"v":"5.3.4","fr":30,"ip":0,"op":38,"w":315,"h":600,"nm":"new", ... }' -); +player.addEventListener("rendered", (e) => { + //Load via URL + player.load("https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json"); + // or load via a Bodymovin JSON string/object + player.load( + '{"v":"5.3.4","fr":30,"ip":0,"op":38,"w":315,"h":600,"nm":"new", ... }' + ); +}); ``` ### TGS-Player