Skin for ANeko
Introduction
ANeko用のスキン。見た目を変更する。
DroidSkin for ANeko
ドロイドくん
Requirements
ANeko v0.1.1 以降
Download

Google Play からダウンロード
Source code is available on GitHub
Changes
How to create skin
Skin is packaged as APK file.
Prerequisites
- Material Images
- At least 10 states; stopping state and moving to 9 direction states.
- Optionally, 2 additional states; left and right edge state.
- Each states are frame animation that has one or more images.
- Development Environment
Import sample to Eclipse
- Download sample project.
- Copy
skin/sample/
directory to workspace. - File > Import... > Existing Project into Workspace.
- Choose copied directory, then press Finish.
- In the package pane, choose
src
> com.example.aneko.sample
. - Choose Refactor > Rename from right click menu.
- Enter new package name and check `Update fully qualified names in non-Java text files', then press Preview.
- Uncheck `
SkinActivity.java
' and `Android Package Rename', then press OK
Edit skin data
- The skin data is indicated by
<meta-data>
tag of Activity that handles org.tamanegi.aneko.action.GET_SKIN
action intent in AndroidManifest.xml
file.android:name
org.tamanegi.aneko.skin
android:resource
- Reference to skin data file.
In the sample project, res/xml/skin.xml
is skin data file.
- Image files of animation are drawable resources.
- Drawable resources are stored in
res/drawable*
directory. - For more details about drawable, see Dev Guide of Android
- The skin data file is written in XML as described below.
Skin data XML
<motion-params>
- Defines the skin data.
This must be the root element. Contains one or more <motion>
elements.acceleration
- Integer. [dp/sec2]
Acceleration rate for moving from stopped state or changing movement direction. maxVelocity
- Integer. [dp/sec]
Maximum velocity for moving state. deaccelerationDistance
- Integer. [dp]
Threshold distance between moving destination and current position to deaccelerate velocity. When distance less than this value, maximum velocity will decrease in proportion to distance. proximityDistance
- Integer. [dp]
Threshold distance between moving destination and current position to stop moving. When distance less than this value, movement will stop. initialState
- String.
Name of initial and stopped state. This state is used when first time and movement is stopped. awakeState
- String.
Name of starting to move state from stopped state. This state is used when user touches display in stopped state. moveStatePrefix
- String.
Prefix of moving state name. Name of state will be generated from this value by appending direction.
Direction is one of follow: Up
, Down
, Left
, Right
, UpLeft
, UpRight
, DownLeft
, DownRight
wallStatePrefix
- String. (optional)
Prefix of left edge and right edge state name. These states are used when stopped at left edge or right edge of display. Name of state will be generated from this value by appending direction.
Direction is one of follow: Left
, Right
<motion>
- Defines a state to describe animation.
Must be a child of <motion-params>
element. Contains <item>
and/or <repeat-item>
elements.state
- String.
Name of this state. States are distinguished and referenced by this name. duration
- Integer. [millisec] (optional)
Duration of this state. When the duration passed, current state transition to next state. If this attribute is omitted or negative value is set, duration is equivalent to total duration of inner animations. nextState
- String. (optional)
Name of next state. When the duration passed, current state transition to specified state.
If checkMove
and/or checkWall
is true
and satisfy condition, this attribute value will not be used. checkMove
- Boolean. (optional)
If set to true
and when need to move, next state is moving state.
See: moveStatePrefix
checkWall
- Boolean. (optional)
If set to true
and current position is left edge or right edge of display, next state is display edge state.
See: wallStatePrefix
<item>
- Defines a frame of animation.
Must be a child of <motion>
or <repeat-item>
element.drawable
- Reference to drawable resource.
An image of frame. duration
- Integer. [millisec] (optional)
Duration of this frame. If this attribute is omitted or negative value is set, duration is equivalent to infinity.
<repeat-item>
- Defines one or more frames. These frames can be repeat once or more times.
Must be a child of <motion>
or <repeat-item>
element. Contains <item>
and/or <repeat-item>
elements.duration
- Integer. [millisec] (optional)
Duration of frames. If this attribute is omitted or negative value is set, duration is equivalent to total duration of inner animations. repeatCount
- Integer. (optional)
Number of repeat count. If this attribute is omitted or negative value is set, animation repeats infinity.
Publishing
Publishing process of skin package is same as normal Android application.
For more details, see Dev Guide of Android
If you publish skin to Google Play, it is recommended to include keywords `ANeko' and `skin' into application name or description for searching.
スキンの作り方
スキンはAPKファイルとしてパッケージ化される。
前準備
- 素材画像
- 最低限10種類の状態が必要。(停止状態と9方向への移動状態)
- オプションで2種類の追加状態。(画面の左端と右端の状態)
- 各状態は1枚以上の画像で構成されるフレームアニメーション。
- 開発環境
サンプルを Eclipse へインポート
- サンプルプロジェクトをダウンロード。
skin/sample/
ディレクトリを作業場所にコピー。- File > Import... > Existing Project into Workspace.
- コピーしたディレクトリを選択し、Finish を押す。
- Package ペインで
src
> com.example.aneko.sample
を選択。 - 右クリックメニューから Refactor > Rename 選択。
- 新しいパッケージ名を入力し、「Update fully qualified names in non-Java text files」をチェックして、Preview を押す。
- 「
SkinActivity.java
」と「Android Package Rename」のチェックを外し、OK を押す。
スキンデータの編集
- スキンデータは
org.tamanegi.aneko.action.GET_SKIN
アクションの Intent を処理する Activity の <meta-data>
タグで指示。android:name
org.tamanegi.aneko.skin
android:resource
- スキンデータファイルへの参照。
サンプルプロジェクトでは res/xml/skin.xml
がスキンデータファイル。
- アニメーションの画像ファイルは drawable リソース。
- スキンデータファイルは以下で説明されているような XML として記述。
スキンデータ XML
<motion-params>
- スキンデータを定義する。
ルート要素でなければならない。1つ以上の <motion>
要素を持つことができる。acceleration
- 整数。[dp/sec2]
停止状態から移動する時、または移動方向を変更する時の加速度。 maxVelocity
- 整数。[dp/sec]
移動状態での最大速度。 deaccelerationDistance
- 整数。[dp]
減速を開始する閾値となる移動目的地から現在位置までの距離。距離がこの値よりも小さい場合、最大速度は距離に比例して小さくなる。 proximityDistance
- 整数。[dp]
移動を停止する閾値となる移動目的地から現在位置までの距離。距離がこの値よりも小さい場合、移動は停止する。 initialState
- 文字列。
初期状態と停止状態の名前。この状態は最初と、移動から停止した時に使用される。 awakeState
- 文字列。
停止状態から移動を開始する時の状態名。この状態は停止状態にユーザーがディスプレイをタッチした時に使用される。 moveStatePrefix
- 文字列。
移動状態名の接頭辞。状態名はこの値に方向を追加して生成される。
方向は次のいずれか: Up
、Down
、Left
、Right
、UpLeft
、UpRight
、DownLeft
、DownRight
wallStatePrefix
- 文字列。(任意)
左端状態名と右端状態名。この状態は画面の左端か右端で停止した場合に使用される。状態名はこの値に方向を追加して生成される。
方向は次のいずれか: Left
、Right
<motion>
- アニメーションする各状態を定義する。
<motion-params>
要素の子要素でなければならない。<item>
と <repeat-item>
要素を持つことができる。state
- 文字列。
状態名。各状態はこの名前で区別、参照される。 duration
- 整数。[millisec] (任意)
この状態の継続時間。継続時間が過ぎると、現在の状態は次の状態へと遷移する。この属性を省略または負の値を設定した場合、持続時間は内包するアニメーションの累計時間と同等。 nextState
- 文字列。(任意)
次状態名。継続時間が過ぎた時、現在の状態は指定された状態へと遷移する。
checkMove
または checkWall
が true
で、条件が満たされている場合は、この属性値は使用されない。 checkMove
- 真偽値。(任意)
true
が設定されていて移動する必要がある場合、次の状態は移動状態となる。
参照: moveStatePrefix
checkWall
- 真偽値。(任意)
true
が設定されていて、現在の位置が画面の左端か右端の場合、次の状態は画面端状態となる。
参照: wallStatePrefix
<item>
- アニメーションのフレームを定義する。
<motion>
または <repeat-item>
要素の子要素でなければならない。drawable
- drawable リソースへの参照。
フレームの画像。 duration
- 整数。[millisec] (任意)
フレームの継続時間。この属性を省略または負の値を設定した場合、継続時間は無限となる。
<repeat-item>
- 1枚以上のフレームを定義する。指定したフレームは1回以上繰り返すことができる。
<motion>
または <repeat-item>
要素の子要素でなければならない。<item>
と <repeat-item>
要素を持つことができる。duration
- 整数。[millisec] (任意)
フレームの継続時間。この属性を省略または負の値を設定した場合、持続時間は内包するアニメーションの累計時間と同等。 repeatCount
- 整数。(任意)
繰り返し回数。この属性を省略または負の値を設定した場合、アニメーションは無限に繰り返す。
公開
スキンパッケージの公開方法は通常の Android アプリケーションと同様。
詳細は Android の Dev Guide を参照。
スキンを Android マーケットに公開する場合は、検索のためにアプリケーション名または説明文に「ANeko」と「skin」を含めることを推奨。