Lottie

注意: lottie 暂时只支持 json 格式动画文件。

注意:监听事件需要 animationListenerState="true"

注意:d05079474695b25d2078.json 文件的路径问题

  • 示例中代码路径: d05079474695b25d2078.json 文件路径为 ProjectPath/src/assets/d05079474695b25d2078.json
  • 打包 rpk 路径为: /android/assets/d05079474695b25d2078.json
  • 运行时存储路径: AppRuntimePath + /assets/d05079474695b25d2078.json,使用es.getESAppRuntimePath() 获取运行时路径。

API

Attributes

NameDescriptionTypeDefault
rawResourcestring-
fileNamestring-
localResourcestring-
urlstring-
fallbackResourcestring-
autoPlayboolean-
loopboolean-
repeatModenumber-
repeatCountnumber0
speedstring-
clipToCompositionBoundsbooleanfalse
defaultFontFileExtensionstring-
imageAssetsFolderstring-
progressstring-
enableMergePathsForKitKatAndAbovebooleanfalse
colorFilterstring-
renderModenumber0
asyncUpdatesnumber0
ignoreDisabledSystemAnimationsbooleanfalse
useCompositionFrameRatebooleanfalse
cacheCompositionbooleanfalse
animationListenerStatebooleanfalse
animationUpdateStatebooleanfalse

Events

NameDescriptionType
onAnimationEnd动画结束事件Function
onAnimationCancel动画取消事件Function
onAnimationStart动画开始事件Function
onAnimationRepeat动画重复执行事件Function
onAnimationPause动画暂停事件Function
onAnimationResume动画恢复事件Function
onAnimationUpdate动画更新事件Function

Slots

NameDescription
default自定义默认内容

Exposes

NameDescriptionType
loadRawFunction
loadFileFunction
loadUrlFunction
loadCacheUrlFunction
setFallbackResourceFunction
setAutoPlayFunction
setLottieLoopFunction
setRepeatModeFunction
setRepeatCountFunction
setSpeedFunction
setClipToCompositionBoundsFunction
setDefaultFontFileExtensionFunction
setImageAssetsFolderFunction
setProgressFunction
enableMergePathsForKitKatAndAboveFunction
setColorFilterFunction
setRenderModeFunction
setAsyncUpdateFunction
setIgnoreDisabledSystemAnimationsFunction
setUseCompositionFrameRateFunction
playAnimationFunction
resumeAnimationFunction
pauseAnimationFunction
cancelAnimationFunction
cacheCompositionFunction
removeAllListenerFunction

Source

ComponentDocs

Contributors