INNER CODE UNIT · Python
get_lottie_js
OpenVGLab/OmniLottie · app.py:468
def get_lottie_js():
global _lottie_js_cache
if _lottie_js_cache is not None:
return _lottie_js_cache
local_path = "lottie.min.js"
if os.path.exists(local_path):
with open(local_path, 'r', encoding='utf-8') as f:
_lottie_js_cache = f.read()
print(f"✅ Loaded local lottie.min.js ({len(_lottie_js_cache)} bytes)")
else:
_lottie_js_cache = '<script src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js"></script>'
print("⚠️ Using CDN lottie.min.js (local file not found)")
return _lottie_js_cache
def create_lottie_html(animation_data, height=600):
bg_style = """