
Panthera Runtime-汎用性の高いアニメーションソフトウェアであるPanthera 2.0エディターで作成されたアニメーションをDefoldプロジェクトに統合するように設計されたDefoldライブラリ。このランタイムライブラリは、Pantheraアニメーションをインポートおよびプレイするプロセスを簡素化し、Defoldゲームとアプリケーションの視覚的な品質と互換性を高めます。
Panthera 2.0エディターガイドを読んで、Defoldプロジェクトのアニメーションの作成を簡素化および強化するように設計されたDefoldエンジンを使用して開発された革新的なツールであるPanthera 2.0エディターについて学びます。
game.projectファイルを開き、プロジェクトセクションの下の依存関係フィールドに次の行を追加します。
Defold tweener
https://github.com/Insality/defold-tweener/archive/refs/tags/3.zip
パンテーラランタイム
https://github.com/Insality/panthera/archive/refs/tags/runtime.4.zip
その後、 Project ▸ Fetch Libraries 、ライブラリの依存関係を更新します。これは、プロジェクトを開くときはいつでも自動的に発生するため、プロジェクトを再開せずに依存関係が変更された場合にのみこれを行う必要があります。
注:ライブラリサイズは、プラットフォームごとのビルドレポートに基づいて計算されます
| プラットフォーム | ライブラリサイズ |
|---|---|
| HTML5 | 12.42 kb |
| デスクトップ /モバイル | 21.35 kb |
注:ホットリロードは、開発環境でのみ使用するために設計されています。ホットリロードは、JSONファイルのアニメーションでのみ機能します。アニメーションにLUAテーブルを使用している場合、ホットリロードは機能しません。
Panthera Runtimeは、より効率的な開発ワークフローのためにアニメーションのホットリロードをサポートしています。この機能により、Defoldゲームを再起動せずにアニメーションを自動的にリロードでき、アニメーション資産の迅速な反復を促進できます。
アニメーションのホットリロードを有効にするには、 game.projectファイルに次の設定を含めます。
[panthera]
hotreload_animations = 1構成の詳細:
1に設定します。この機能は、デバッグモードでのみアクティブです。defoldでホットリロードを実装する:
ホットリロードを利用するには、Defoldスクリプトにウィンドウイベントリスナーを設定し、 panthera.reload_animation()をトリガーしたゲームウィンドウが焦点を獲得します。これにより、開発中にアニメーションが自動的に更新されることが保証されます。
local panthera = require ( " panthera.panthera " )
-- Reload animation when window is focused, only for debug and on desktop
window . set_listener ( function ( _ , event )
if event == window . WINDOW_EVENT_FOCUS_GAINED then
panthera . reload_animation ()
end
end ) panthera . create_gui ( animation_path_or_data , [ template ], [ nodes ])
panthera . create_go ( animation_path_or_data , [ collection_name ], [ objects ])
panthera . create ( animation_path_or_data , adapter , get_node )
panthera . clone_state ( animation_state )
panthera . play ( animation_state , animation_id , [ options ])
panthera . stop ( animation_state )
panthera . set_time ( animation_state , animation_id , time )
panthera . get_time ( animation_state )
panthera . get_duration ( animation_state , animation_id )
panthera . is_playing ( animation_state )
panthera . get_latest_animation_id ( animation_state )
panthera . set_logger ([ logger_instance ])
panthera . reload_animation ([ animation_path ])API参照ファイルを読んで、モジュールの完全なAPIドキュメントを確認してください。
これらの簡潔な例を使用して、PantheraアニメーションをDefoldに統合します。
GOアダプターを使用してアニメーションファイルをロードして再生します。
local panthera = require ( " panthera.panthera " )
local animation = require ( " path.to.panthera_animation " )
function init ( self )
self . animation = panthera . create_go ( animation )
panthera . play ( self . animation , " run " , { is_loop = true })
endこの例では、ゲームの開始時にループランアニメーションをゲームオブジェクトに適用します。
GUIアダプターを使用してアニメーションファイルをロードして再生します。
local panthera = require ( " panthera.panthera " )
local animation = require ( " path.to.panthera_animation " )
function init ( self )
self . animation = panthera . create_gui ( animation )
panthera . play ( self . animation , " fade_in " )
endこの例では、ゲームが開始されたときにフェードインアニメーションをGUIノードに適用します
現在、アニメーションが再生されているかどうかを確認し、現在のアニメーションIDを取得します。
local panthera = require ( " panthera.panthera " )
function init ( self )
-- You can use JSON instead of Lua tables, but it should be accessible with sys.load_resource()
self . animation = panthera . create_gui ( " /animations/animation.json " )
local is_playing = panthera . is_playing ( self . animation )
local animation_id = panthera . get_latest_animation_id ( self . animation )
if is_playing then
print ( " The animation is currently playing: " , animation_id )
else
print ( " The animation is not playing " )
end
endPanthera 2.0アニメーションをDefold Game Objects(GOS)と統合する場合、どのプロパティをアニメーション化できるかを知ることが不可欠です。
デフォルトでは、Spriteコンポーネントはtintプロパティを使用し、ラベルコンポーネントはcolorプロパティを使用します。 Pantheraはcolorプロパティを使用しようとします。 colorプロパティを有効にするには、Spriteコンポーネントの素材を/panthera/materials/sprite.materialに設定するか、 color属性のある他の素材を使用する必要があります。
アニメーションブレンディングガイドを読んで、同じエンティティで複数のアニメーションを同時にブレンドする方法を学び、ゲームの視覚的な忠実さとダイナミズムを強化する複雑で階層化されたアニメーションを作成します。
Panthera RuntimeはゲームオブジェクトとGUIにデフォルトのアダプターを提供しますが、プロジェクトのニーズに基づいてアダプターをカスタマイズする必要がある場合があります。アダプターガイドのカスタマイズをお読みください。緩和タイプのマッピング方法、カスタムイベントの処理方法、Pantheraランタイムでカスタムアダプターを使用する方法を学びます。
Pantheraランタイムは、MITライセンスに基づいてライセンスされています。詳細については、ライセンスファイルを参照してください。
問題、質問、または提案については、問題を作成してください。
Changelogを読んで、Panthera Runtimeの最新の更新と機能について学びます。
あなたのサポートは、 Defoldのプロジェクトを作成して維持し続けるように動機付けます。私のプロジェクトが役立つ、価値があると思う場合は、サポートを検討してください。