「App:Library:LVGL:docs:3rd party libraries:Lottie player」の版間の差分
26行目: | 26行目: | ||
To build on desktop you can follow the instructions from Rlottie's README. In the most basic case it looks like this: | To build on desktop you can follow the instructions from Rlottie's README. In the most basic case it looks like this: | ||
+ | <syntaxhighlight lang="Python" style="border:1px dashed gray;"> | ||
mkdir rlottie_workdir | mkdir rlottie_workdir | ||
cd rlottie_workdir | cd rlottie_workdir | ||
34行目: | 35行目: | ||
make -j | make -j | ||
sudo make install | sudo make install | ||
+ | </syntaxhighlight> | ||
And finally add the <code style="color: #bb0000;">-lrlottie</code> flag to your linker. | And finally add the <code style="color: #bb0000;">-lrlottie</code> flag to your linker. | ||
40行目: | 42行目: | ||
デスクトップ上に構築するには、RlottieのREADMEの指示に従うことができます。最も基本的なケースでは、次のようになります。 | デスクトップ上に構築するには、RlottieのREADMEの指示に従うことができます。最も基本的なケースでは、次のようになります。 | ||
+ | <syntaxhighlight lang="Python" style="border:1px dashed gray;"> | ||
mkdir rlottie_workdir | mkdir rlottie_workdir | ||
cd rlottie_workdir | cd rlottie_workdir | ||
48行目: | 51行目: | ||
make -j | make -j | ||
sudo make install | sudo make install | ||
− | そして最後に、<code>-lrlottie</code>フラグをリンカーに追加します。 | + | </syntaxhighlight> |
+ | そして最後に、<code style="color: #bb0000;">-lrlottie</code>フラグをリンカーに追加します。 | ||
組み込みシステムでは、Rlottieを特定のビルドシステムに統合する必要があります。 | 組み込みシステムでは、Rlottieを特定のビルドシステムに統合する必要があります。 | ||
64行目: | 68行目: | ||
The <code style="color: #bb0000;">width</code> and <code style="color: #bb0000;">height</code> of the object be set in the ''create'' function and the animation will be scaled accordingly. | The <code style="color: #bb0000;">width</code> and <code style="color: #bb0000;">height</code> of the object be set in the ''create'' function and the animation will be scaled accordingly. | ||
− | |ファイルまたは生データ(テキスト)からのアニメーションを使用できます。いずれの場合も、最初にで有効<code>LV_USE_RLOTTIE</code>にする必要があります<code>lv_conf.h</code>。 | + | |ファイルまたは生データ(テキスト)からのアニメーションを使用できます。いずれの場合も、最初にで有効<code style="color: #bb0000;">LV_USE_RLOTTIE</code>にする必要があります<code style="color: #bb0000;">lv_conf.h</code>。 |
− | オブジェクトの<code>width</code>とは''create''関数で設定され、アニメーションはそれに応じてスケーリングされます。 <code>height</code> | + | オブジェクトの<code style="color: #bb0000;">width</code>とは''create''関数で設定され、アニメーションはそれに応じてスケーリングされます。 <code style="color: #bb0000;">height</code> |
|} | |} | ||
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] | :[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] | ||
106行目: | 110行目: | ||
− | <code>lv_example_rlottie_approve.c</code>生の形式のアニメーションの例が含まれています。代わりに、JSON文字列を格納する代わりに、次の理由で16進配列が格納されます。 | + | <code style="color: #bb0000;">lv_example_rlottie_approve.c</code>生の形式のアニメーションの例が含まれています。代わりに、JSON文字列を格納する代わりに、次の理由で16進配列が格納されます。 |
− | * LVGLでロッティアニメーションを使用できます。このベースリポジトリから取得<code>"</code>JSONファイルでのエスケープを避けてください | + | * LVGLでロッティアニメーションを使用できます。このベースリポジトリから取得<code style="color: #bb0000;">"</code>JSONファイルでのエスケープを避けてください |
* 一部のコンパイラは非常に長い文字列をサポートしていません | * 一部のコンパイラは非常に長い文字列をサポートしていません | ||
− | <code>lvgl/scripts/filetohex.py</code>Lottieファイルを16進配列に変換するために使用できます。例えば: | + | <code style="color: #bb0000;">lvgl/scripts/filetohex.py</code>Lottieファイルを16進配列に変換するために使用できます。例えば: |
./filetohex.py path / to / lottie.json> out.txt | ./filetohex.py path / to / lottie.json> out.txt | ||
生データからアニメーションを作成するには: | 生データからアニメーションを作成するには: | ||
159行目: | 163行目: | ||
To get the number of frames in an animation or the current frame index, you can cast the <code style="color: #bb0000;">lv_obj_t</code> instance to a <code style="color: #bb0000;">lv_rlottie_t</code> instance and inspect the <code style="color: #bb0000;">current_frame</code> and <code style="color: #bb0000;">total_frames</code> members. | To get the number of frames in an animation or the current frame index, you can cast the <code style="color: #bb0000;">lv_obj_t</code> instance to a <code style="color: #bb0000;">lv_rlottie_t</code> instance and inspect the <code style="color: #bb0000;">current_frame</code> and <code style="color: #bb0000;">total_frames</code> members. | ||
− | |LVGLには、アニメーションモードを制御するための2つの関数とが<code>lv_rlottie_set_play_mode</code>あり<code>lv_rlottie_set_current_frame</code>ます。次の例のように、最初のメソッドを呼び出すときに意図を組み合わせます。 | + | |LVGLには、アニメーションモードを制御するための2つの関数とが<code style="color: #bb0000;">lv_rlottie_set_play_mode</code>あり<code style="color: #bb0000;">lv_rlottie_set_current_frame</code>ます。次の例のように、最初のメソッドを呼び出すときに意図を組み合わせます。 |
lv_obj_t * lottie = lv_rlottie_create_from_file(scr、128、128、 "test.json"); | lv_obj_t * lottie = lv_rlottie_create_from_file(scr、128、128、 "test.json"); | ||
lv_obj_center(lottie); | lv_obj_center(lottie); | ||
173行目: | 177行目: | ||
デフォルトのアニメーションモードは、ループ再生です。 | デフォルトのアニメーションモードは、ループ再生です。 | ||
− | ループを有効にしない<code>LV_EVENT_READY</code>場合、アニメーションがループせずにそれ以上進行できないときにaが送信されます。 | + | ループを有効にしない<code style="color: #bb0000;">LV_EVENT_READY</code>場合、アニメーションがループせずにそれ以上進行できないときにaが送信されます。 |
− | アニメーションのフレーム数または現在のフレームインデックスを取得するには、<code>lv_obj_t</code>インスタンスをインスタンスにキャストして、およびメンバー <code>lv_rlottie_t</code>を検査します。<code>current_frametotal_frames</code> | + | アニメーションのフレーム数または現在のフレームインデックスを取得するには、<code style="color: #bb0000;">lv_obj_t</code>インスタンスをインスタンスにキャストして、およびメンバー <code style="color: #bb0000;">lv_rlottie_t</code>を検査します。<code style="color: #bb0000;">current_frametotal_frames</code> |
|} | |} | ||
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] | :[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] |
2022年6月29日 (水) 17:15時点における版
https://docs.lvgl.io/8.2/libs/rlottie.html
Lottie player
英文 | 自動翻訳 |
---|---|
Allows to use Lottie animations in LVGL. Taken from this base repository LVGL provides the interface to Samsung/rlottie library's C API. That is the actual Lottie player is not part of LVGL, it needs to be built separately. |
LVGLでロッティアニメーションを使用できます。このベースリポジトリから取得
LVGLは、Samsung/rlottieライブラリのCAPIへのインターフェイスを提供します。つまり、実際のLottieプレーヤーはLVGLの一部ではなく、個別に構築する必要があります。 |
Build Rlottie
英文 | 自動翻訳 |
---|---|
To build Samsung's Rlottie C++14-compatible compiler and optionally CMake 3.14 or higher is required. To build on desktop you can follow the instructions from Rlottie's README. In the most basic case it looks like this: mkdir rlottie_workdir
cd rlottie_workdir
git clone <nowiki>https://github.com/Samsung/rlottie.git</nowiki>
mkdir build
cd build
cmake ../rlottie
make -j
sudo make install
And finally add the On embedded systems you need to take care of integrating Rlottie to the given build system. |
SamsungのRlottieC++ 14互換コンパイラをビルドするには、オプションでCMake3.14以降が必要です。
デスクトップ上に構築するには、RlottieのREADMEの指示に従うことができます。最も基本的なケースでは、次のようになります。 mkdir rlottie_workdir
cd rlottie_workdir
git clone <nowiki>https://github.com/Samsung/rlottie.git</nowiki>
mkdirビルド
cdビルド
cmake ../rlottie
make -j
sudo make install
そして最後に、 組み込みシステムでは、Rlottieを特定のビルドシステムに統合する必要があります。 |
Usage
英文 | 自動翻訳 |
---|---|
You can use animation from files or raw data (text). In either case first you need to enable The |
ファイルまたは生データ(テキスト)からのアニメーションを使用できます。いずれの場合も、最初にで有効LV_USE_RLOTTIE にする必要がありますlv_conf.h 。
オブジェクトの |
Use Rlottie from file
英文 | 自動翻訳 |
---|---|
To create a Lottie animation from file use: lv_obj_t * lottie = lv_rlottie_create_from_file(parent, width, height, "path/to/lottie.json"); Note that, Rlottie uses the standard STDIO C file API, so you can use the path "normally" and no LVGL specific driver letter is required. |
ファイルからロッティアニメーションを作成するには、次のようにします。
lv_obj_t * lottie = lv_rlottie_create_from_file(parent、width、height、 "path / to / lottie.json"); Rlottieは標準のSTDIOCファイルAPIを使用するため、パスを「通常」に使用でき、LVGL固有のドライバー文字は必要ありません。 |
Use Rlottie from raw string data
英文 | 自動翻訳 |
---|---|
./filetohex.py path/to/lottie.json > out.txt To create an animation from raw data: extern const uint8_t lottie_data[]; lv_obj_t* lottie = lv_rlottie_create_from_raw(parent, width, height, (const char *)lottie_data); |
./filetohex.py path / to / lottie.json> out.txt 生データからアニメーションを作成するには: extern const uint8_t lottie_data []; lv_obj_t * lottie = lv_rlottie_create_from_raw(parent、width、height、(const char *)lottie_data); |
Getting animations
英文 | 自動翻訳 |
---|---|
Lottie is standard and popular format so you can find many animation files on the web. For example: https://lottiefiles.com/ You can also create your own animations with Adobe After Effects or similar software. |
Lottieは標準的で人気のある形式であるため、Web上で多くのアニメーションファイルを見つけることができます。例:https://lottiefiles.com/
AdobeAfterEffectsまたは同様のソフトウェアを使用して独自のアニメーションを作成することもできます。 |
Controlling animations
英文 | 自動翻訳 |
---|---|
LVGL provides two functions to control the animation mode: lv_obj_t * lottie = lv_rlottie_create_from_file(scr, 128, 128, "test.json"); lv_obj_center(lottie); // Pause to a specific frame lv_rlottie_set_current_frame(lottie, 50); lv_rlottie_set_play_mode(lottie, LV_RLOTTIE_CTRL_PAUSE); // The specified frame will be displayed and then the animation will pause // Play backward and loop lv_rlottie_set_play_mode(lottie, LV_RLOTTIE_CTRL_PLAY | LV_RLOTTIE_CTRL_BACKWARD | LV_RLOTTIE_CTRL_LOOP); // Play forward once (no looping) lv_rlottie_set_play_mode(lottie, LV_RLOTTIE_CTRL_PLAY | LV_RLOTTIE_CTRL_FORWARD); The default animation mode is play forward with loop. If you don't enable looping, a To get the number of frames in an animation or the current frame index, you can cast the |
LVGLには、アニメーションモードを制御するための2つの関数とがlv_rlottie_set_play_mode ありlv_rlottie_set_current_frame ます。次の例のように、最初のメソッドを呼び出すときに意図を組み合わせます。
lv_obj_t * lottie = lv_rlottie_create_from_file(scr、128、128、 "test.json"); lv_obj_center(lottie); //特定のフレームに一時停止します lv_rlottie_set_current_frame(lottie、50); lv_rlottie_set_play_mode(lottie、LV_RLOTTIE_CTRL_PAUSE); //指定したフレームが表示され、アニメーションが一時停止します //逆方向に再生してループします lv_rlottie_set_play_mode(lottie、LV_RLOTTIE_CTRL_PLAY | LV_RLOTTIE_CTRL_BACKWARD | LV_RLOTTIE_CTRL_LOOP); // 1回前方に再生します(ループなし) lv_rlottie_set_play_mode(lottie、LV_RLOTTIE_CTRL_PLAY | LV_RLOTTIE_CTRL_FORWARD); デフォルトのアニメーションモードは、ループ再生です。 ループを有効にしない アニメーションのフレーム数または現在のフレームインデックスを取得するには、 |
Example
英文 | 自動翻訳 |
---|---|
Load a Lottie animation from raw data |
|
Load a Lottie animation from a file |
API
英文 | 自動翻訳 |
---|---|
Enums enum lv_rlottie_ctrl_t
Functions lv_obj_t *lv_rlottie_create_from_file(lv_obj_t *parent, lv_coord_t width, lv_coord_t height, const char *path) lv_obj_t *lv_rlottie_create_from_raw(lv_obj_t *parent, lv_coord_t width, lv_coord_t height, const char *rlottie_desc) void lv_rlottie_set_play_mode(lv_obj_t *rlottie, const lv_rlottie_ctrl_t ctrl) void lv_rlottie_set_current_frame(lv_obj_t *rlottie, const size_t goto_frame) Variables const lv_obj_class_t lv_rlottie_class struct lv_rlottie_t
|
列挙型lv_rlottie_ctrl_t
機能 lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent、lv_coord_t width、lv_coord_t height、const char * path) lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent、lv_coord_t width、lv_coord_t height、const char * rlottie_desc) void lv_rlottie_set_play_mode(lv_obj_t * rlottie、const lv_rlottie_ctrl_t ctrl) void lv_rlottie_set_current_frame(lv_obj_t * rlottie、const size_t goto_frame) 変数 const lv_obj_class_t lv_rlottie_class struct lv_rlottie_t
|