Lottie is an open-source library that allows us to use high-quality, theme-aware animations rendered from After Effects directly in Chrome.
Follow these steps to integrate a new Lottie animation for the first time.
Add your JSON file to an appropriate folder (e.g., chrome/browser/resources).
Define a new structured entry in an appropriate grit resources file (.grd).
brotli compression.Example:
<structure type="lottie" name="IDR_AUTOFILL_SAVE_PASSWORD_LOTTIE" file="resources/autofill/autofill_save_password.json" compress="brotli"/>
Retrieve the image from ResourceBundle.
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); ui::ImageModel image = bundle.GetThemedLottieImageNamed(IDR_YOUR_LOTTIE_IMAGE); auto image_view = std::make_unique<views::ImageView>(image);
If you have an existing illustration in PNG format, follow these steps to convert it to a Lottie animation.
cdds.sys.color...).ThemeTrackingNonAccessibleImageView, ensure you call image_view->GetViewAccessibility().SetIsIgnored(true) to maintain the same behavior.