1. 程式人生 > >Lottie動畫框架的基本使用

Lottie動畫框架的基本使用

GIthub地址

https://github.com/airbnb/lottie-android

導包

//設定發現會編譯失敗
compile 'com.airbnb.android:lottie:2.5.3'
//beta版本可以
compile 'com.airbnb.android:lottie:2.0.0-beta4'

準備動畫檔案

///assets/test.json

{"v":"5.1.8","fr":29.1670074462891,"ip":0,"op":190.0000485067,"w":1920,"h":1080,"nm":"Ping pong cup","ddd":0,"assets":[]
,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"CUP 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.236,"y":1},"o":{"x":0.333,"y":0},"n":"0p236_1_0p333_0","t":90,"s":[1517.941,539.989,0],"e":[350.808,539.989,0],"to":[-194.52214050293,0,0],"ti":[129.681381225586,0,0]},{"i":{"x":0.249
,"y":1}
,"o":{"x":0.167,"y":0},"n":"0p249_1_0p167_0","t":120,"s":[350.808,539.989,0],"e":[739.853,539.989,0],"to":[-129.681381225586,0,0],"ti":[-64.8407516479492,0,0]},{"t":140.000035741779}]
,"ix":2}
,"a":{"a":0,"k":[141.651,147.001,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}}
,"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix
":1,"ks":{"a":0,"k":{"i":[[-1.582,-10.354],[0,0],[0,0],[0,-10.514],[10.515,0],[0,0],[0,10.515],[10.515,0],[0,0],[0,0],[10.476,0],[0,0]],"o":[[0,0],[0,0],[10.515,0],[0,10.516],[0,0],[10.515,0],[0,-10.515],[0,0],[0,0],[-1.582,-10.355],[0,0],[10.476,0]],"v":[[-41.86,-128.748],[-5.59,108.675],[0.954,108.675],[19.992,127.712],[0.954,146.751],[43.788,146.751],[62.826,127.713],[43.788,108.676],[37.244,108.676],[0.974,-128.747],[-19.989,-146.75],[-62.823,-146.75]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":4,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.090000002992,0.113999998803,0.149000010771,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[220.227,147.001],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":30,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}]
,"nm":"Group 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-2.958,0],[0,0],[0,-2.958],[2.957,0],[0,0],[0,2.958]],"o":[[0,0],[2.957,0],[0,2.958],[0,0],[-2.958,0],[0,-2.958]],"v":[[-50.54,-5.354],[50.54,-5.354],[55.894,0],[50.54,5.354],[-50.54,5.354],[-55.894,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":4,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.823999980852,0.33300000359,0.352999997606,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[141.651,30.304],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-2.957,0],[0,0],[0,-2.958],[2.957,0],[0,0],[0,2.958]],"o":[[0,0],[2.957,0],[0,2.958],[0,0],[-2.958,0],[0,-2.958]],"v":[[-59.873,-5.354],[59.873,-5.354],[65.227,0],[59.873,5.354],[-59.873,5.354],[-65.227,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":4,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.823999980852,0.33300000359,0.352999997606,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[141.651,54.159],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":3,"cix":2,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-2.957,0],[0,0],[0,-2.958],[2.958,0],[0,0],[0,2.959]],"o":[[0,0],[2.958,0],[0,2.959],[0,0],[-2.957,0],[0,-2.958]],"v":[[-75.196,-5.355],[75.196,-5.355],[80.55,-0.001],[75.196,5.355],[-75.196,5.355],[-80.55,-0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":4,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.823999980852,0.33300000359,0.352999997606,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[141.651,204.645],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":3,"cix":2,"ix":4,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-2.957,0],[0,0],[0,-2.958],[2.957,0],[0,0],[0,2.958]],"o":[[0,0],[2.957,0],[0,2.958],[0,0],[-2.958,0],[0,-2.958]],"v":[[-89.083,-5.354],[89.082,-5.354],[94.437,0],[89.082,5.354],[-89.082,5.354],[-94.437,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":4,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.823999980852,0.33300000359,0.352999997606,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[141.651,228.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":3,"cix":2,"ix":5,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-10.515,0],[0,0],[0,10.516],[10.514,0],[0,0],[0,-10.514]],"o":[[0,0],[10.514,0],[0,-10.515],[0,0],[-10.515,0],[0,10.515]],"v":[[-122.364,19.038],[122.364,19.038],[141.401,-0.001],[122.364,-19.038],[-122.363,-19.038],[-141.401,-0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":4,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.948999980852,0.913999968884,0.862999949736,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[141.651,274.714],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 6","np":3,"cix":2,"ix":6,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[113.311,-17.729],[-113.311,-17.729],[-118.728,17.729],[118.728,17.729]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"

相關推薦

Lottie動畫框架基本使用

GIthub地址 https://github.com/airbnb/lottie-android 導包 //設定發現會編譯失敗 compile 'com.airbnb.android

Android動畫框架之檢視動畫基本使用

      之前在學習View 滑動的時候其實就是View動畫的一種展現形式了,當時介紹了有7中方法可以實現View的滑動,截止目前還有Sroller,動畫以及ViewDragHelper實現沒有介紹,今天的內容裡面就包含了部分View的滑動實現,這裡說部分主要有兩個原

Android屬性動畫完全解析(上),初識屬性動畫基本用法

fcm 操作 fad 擴展性 改變 內部使用 如果 轉載 @override 轉載請註明出處:http://blog.csdn.net/guolin_blog/article/details/43536355 在手機上去實現一些動畫效果算是件比較炫酷的事情,因此Andr

Rebound動畫框架簡單介紹

reference enc take euler 構造 技術 systems pty instance Rebound動畫框架簡單介紹 Android菜鳥一枚,有不對的地方希望大家指出,謝謝。 最近在接手了一個老項目,發現裏面動畫框架用的是facebook中的Re

CI框架基本配置/教你學習CI框架codelgniter

for 框架 base_url sys 就是 body 用戶手冊 我想 應該 CI框架現在中國可以說還是不成熟,不像thinkphp那樣有那麽多的中文手冊,在國內,很多國人英語都很爛,CI現在教程還是不多。大家心裏都存在這嚴重想法 CI 框架現在中國可以說還是不成熟,不像

Android-25種開源炫酷動畫框架

提示控件 進度顯示 風格 spl nec 用戶 refresh class art 前言 忙碌的工作終於可以停息一段時間了,最近突然有一個想法,就是自己寫一個app,所以找了一些合適開源控件,這樣更加省時,再此分享給大家,希望能對大家有幫助,此博文介紹的都是UI上面的框架

Lottie 動畫裏有圖片怎麽辦?設計師小姐姐也能幫你減少開發量!

rom 允許 f11 strong 方案 user a13 bbf andorid 一、序 Hi,大家好,我是承香墨影! Lottie 是 Airbnb 開源的一套跨平臺的完整解決方案,設計師只需要使用 After Effectes (之後簡稱 AE)設計出動畫之後,使用

簡單模擬jQuery創建對象的方法,以及封裝一個js動畫框架

動畫框架 dst nts 創建 pro 以及 原型 time parse 今天無事點開了N年未點開的慕課網,看了一個js動畫框架的視頻,心血來潮用jQuery的方法封裝了一下,雖然不如jQuery,但是還是有點點所獲。 什麽都不說,直接上代碼: /** * 這是框架的

Django框架基本原理1

patch body code spl 所有 net username register django框架 Django之請求的本質 本質上django程序就是一個socket服務端,用戶的瀏覽器其實就是一個socket客戶端; 在遵循http協議的基礎上兩方進行通訊;

**DRF框架基本使用**

DRF框架基本使用 1. 總綱 web開發的兩種模式(前後端不分離&前後端分離) -> RestAPI設計風格 -> 使用Django基礎知識自定義一套RestAPI介面 -> 分析定義RestAPI介面開發時的主要工作 -> DRF框架的特點及使用。

Animation動畫——ObjectAnimator基本使用

一、概述 1、引入 上幾篇給大家講了ValueAnimator,但ValueAnimator有個缺點,就是隻能對數值對動畫計算。我們要想對哪個控制元件操作,需要監聽動畫過程,在監聽中對控制元件操作。這樣使用起來相比補間動畫而言就相對比較麻煩。為了能讓動畫直接與對應控制元件相關聯,以使我們

Android 動畫框架

Android 好用的框架與UI效果demo收集 1.炫酷開屏動畫框架 github https://github.com/JoshuaRogue/FancyView  2.Animate 一個教你基礎動畫實現的dome github https

對2個網頁幀動畫框架的調研

背景描述 需求中有的地方需要用到動畫,設計動畫的軟體主要有AE和Spine,新入職的動效設計師可能之前是做遊戲動畫設計的,他給了我們一份Spine動畫匯出的資源,於是我開始了Spine的調研。 我們對動畫框架的要求 和寧哥溝通過後,明確了我們開發這邊對於動畫框架的3點要求 能夠完成動畫的渲染

Lottie 動畫

本文主要講解 Lottie 庫動態載入 SD 卡上帶圖片資源的動畫,並對各種機型做全屏適配。 Lottie 的優點: 跨平臺,支援 Android、iOS、React Native 平臺 支援實時渲染 After Effects 動畫,讓 app 載入動

Android動畫(三)-動畫框架

概述 上兩篇介紹了一些動畫基礎 Android動畫(一)-檢視動畫 Android動畫(二)-屬性動畫 但是開發中為了開發效率,我們通常是使用一些三方的庫,有前輩已經封裝了很完善的動畫庫,我們學習一下直接用,使用中還能探尋框架作者的設計思路,事半功倍,何樂不為~ 1 常

屬性動畫基本使用

動畫分為:幀動畫,補間動畫,屬性動畫 屬性動畫實現的效果與補間動畫非常相似, 最大的區別:屬性動畫真實的改變了控制元件的屬性,而補間動畫只是幻影 屬性動畫是在Android3.0以後才出現,所以要高於API11的情況下 下面是一些按鈕的點選事件:佈局就不寫了,比較簡單 @Ove

ssm框架基本實現配置

dao層與pojo層使用generatorSqlmapCustom逆向工程自動生存的程式碼 1.db.properties的配置 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/springm

laravel框架基本路由及其跳轉方法

laravel的路由在routes\web.php下   配置資訊 Route::any('/zc','[email protected]'); 注:zc就是路由的名字在你域名後面加上/zc就是進入了ZcControlle控制器add'方法裡 js&

SpringMVC框架基本配置

一:springmvc框架的主要配置檔案: 1、applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> 2、dispatcher-servlet.xml <?xml ver

Spring框架學習之路(一)——Spring框架基本介紹

Spring的出現是為了取代EJB(Enterprise JavaBean)的臃腫、低效、脫離現實的缺點。Spring致力於J2EE應用的各層(表現層、業務層、持久層)的解決方案,Spring是企業應用開發的“一站式”選擇。 1.Spring定義: Spring是分層的J