Package com.airbnb.lottie
Class LottieComposition
- java.lang.Object
-
- com.airbnb.lottie.LottieComposition
-
public class LottieComposition extends Object
After Effects/Bodymovin composition model. This is the serialized model from which the animation will be created. It is designed to be stateless, cacheable, and shareable.To create one, use
LottieCompositionFactory.It can be used with a
LottieAnimationVieworLottieDrawable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLottieComposition.FactoryDeprecated.
-
Constructor Summary
Constructors Constructor Description LottieComposition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWarning(String warning)RectgetBounds()androidx.collection.SparseArrayCompat<FontCharacter>getCharacters()floatgetDuration()floatgetDurationFrames()floatgetEndFrame()Map<String,Font>getFonts()floatgetFrameForProgress(float progress)floatgetFrameRate()Map<String,LottieImageAsset>getImages()Returns a map of image asset id toLottieImageAsset.List<Layer>getLayers()MarkergetMarker(String markerName)List<Marker>getMarkers()intgetMaskAndMatteCount()Used to determine if an animation can be drawn with hardware acceleration.PerformanceTrackergetPerformanceTracker()List<Layer>getPrecomps(String id)floatgetProgressForFrame(float frame)floatgetStartFrame()ArrayList<String>getWarnings()booleanhasDashPattern()Used to determine if an animation can be drawn with hardware acceleration.booleanhasImages()voidincrementMatteOrMaskCount(int amount)voidinit(Rect bounds, float startFrame, float endFrame, float frameRate, List<Layer> layers, androidx.collection.LongSparseArray<Layer> layerMap, Map<String,List<Layer>> precomps, Map<String,LottieImageAsset> images, androidx.collection.SparseArrayCompat<FontCharacter> characters, Map<String,Font> fonts, List<Marker> markers)LayerlayerModelForId(long id)voidsetHasDashPattern(boolean hasDashPattern)voidsetPerformanceTrackingEnabled(boolean enabled)StringtoString()
-
-
-
Method Detail
-
init
public void init(Rect bounds, float startFrame, float endFrame, float frameRate, List<Layer> layers, androidx.collection.LongSparseArray<Layer> layerMap, Map<String,List<Layer>> precomps, Map<String,LottieImageAsset> images, androidx.collection.SparseArrayCompat<FontCharacter> characters, Map<String,Font> fonts, List<Marker> markers)
-
addWarning
public void addWarning(String warning)
-
setHasDashPattern
public void setHasDashPattern(boolean hasDashPattern)
-
incrementMatteOrMaskCount
public void incrementMatteOrMaskCount(int amount)
-
hasDashPattern
public boolean hasDashPattern()
Used to determine if an animation can be drawn with hardware acceleration.
-
getMaskAndMatteCount
public int getMaskAndMatteCount()
Used to determine if an animation can be drawn with hardware acceleration.
-
setPerformanceTrackingEnabled
public void setPerformanceTrackingEnabled(boolean enabled)
-
getPerformanceTracker
public PerformanceTracker getPerformanceTracker()
-
layerModelForId
public Layer layerModelForId(long id)
-
getBounds
public Rect getBounds()
-
getDuration
public float getDuration()
-
getStartFrame
public float getStartFrame()
-
getEndFrame
public float getEndFrame()
-
getFrameForProgress
public float getFrameForProgress(float progress)
-
getProgressForFrame
public float getProgressForFrame(float frame)
-
getFrameRate
public float getFrameRate()
-
getCharacters
public androidx.collection.SparseArrayCompat<FontCharacter> getCharacters()
-
hasImages
public boolean hasImages()
-
getImages
public Map<String,LottieImageAsset> getImages()
Returns a map of image asset id toLottieImageAsset. These assets contain image metadata exported from After Effects or other design tool. The resulting Bitmaps can be set directly on the image asset so they can be loaded once and reused across compositions.
-
getDurationFrames
public float getDurationFrames()
-
-