commit | 71c1622ae3c145e5afaf6bbdd0a2edd274f49864 | [log] [tgz] |
---|---|---|
author | Allen Chen <allenchen1154@gmail.com> | Wed Jul 24 15:30:02 2024 -0700 |
committer | GitHub <noreply@github.com> | Wed Jul 24 15:30:02 2024 -0700 |
tree | d547a77e6b30659da0e376f0804cc63fa773db83 | |
parent | 328fc724a64ead26f13ccb97d1ce6075b6fee173 [diff] |
Add support for text range selectors (#2518) This adds support for the [text range selector](https://lottiefiles.github.io/lottie-docs/text/#text-range-selector) type, which allows a [text style](https://lottiefiles.github.io/lottie-docs/text/#text-style) to be applied to a certain range of the text, defined by a start, end, and offset. The text range selector implementation currently has the following limitations: - Only text layers drawn using a Font are supported. Adding support for the glyph draw path may be possible, but I don't have a sample Lottie file. - Only one text range is currently supported per text layer, as the parser [drops all other entries in the array](https://github.com/airbnb/lottie-android/blob/c4cb2254eca3c70199f1de5e39e3872c8c42e473/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java#L194-L196). - Only index-based ranges are supported - percentage-based ranges are also allowed in the spec. - Only ranges based on characters are supported. The [spec](https://lottiefiles.github.io/lottie-docs/constants/#text-based) allows characters, characters excluding spaces, words, and lines. - Other options like easing (allows styling characters that are partially inside the range), randomize, and [shape](https://lottiefiles.github.io/lottie-docs/constants/#text-shape) of the range are not currently supported. This also adds support for the opacity as an animatable text property which is applied multiplicatively with the transform opacity and the parent's alpha. Partially addresses https://github.com/airbnb/lottie-android/issues/485. https://github.com/user-attachments/assets/bcfad060-482d-48d9-a578-297c4f143ba9 https://github.com/user-attachments/assets/211dc574-5ea1-4fa3-9f78-f87ee104ce85 Co-authored-by: Allen Chen <allen.chen@airbnb.com>
Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile!
For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand. They say a picture is worth 1,000 words so here are 13,000:
Lottie is maintained and improved on nights and weekends. If you use Lottie in your app, please consider sponsoring it to help ensure that we can continue to improve the project we love. Click the sponsor button above to learn more
Gradle is the only supported build configuration, so just add the dependency to your project build.gradle
file:
dependencies { implementation 'com.airbnb.android:lottie:$lottieVersion' }
The latest Lottie version is:
The latest stable Lottie-Compose version is: Click here for more information on Lottie-Compose.
Lottie 2.8.0 and above only supports projects that have been migrated to androidx. For more information, read Google's migration guide.
Because development has started for Lottie Compose, Gradle, and the Android Gradle Plugin will be kept up to date with the latest canaries. This also requires you to use Android Studio Canary builds. Preview builds can be installed side by side with stable versions.