动画编码完成

This commit is contained in:
xsl
2025-10-31 14:22:08 +08:00
parent dfbef7caf1
commit 2555047190
80 changed files with 332 additions and 92 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

@@ -0,0 +1,125 @@
{
"11": [
"11.png"
],
"12": [
"12.png"
],
"13": [
"13.png"
],
"14": [
"14.png"
],
"21": [
"21.png"
],
"23": [
"23.png"
],
"24": [
"24.png"
],
"25": [
"25.png"
],
"26": [
"26.png"
],
"27": [
"27.png"
],
"32": [
"32.png"
],
"37": [
"37.png"
],
"4": [
"4.png"
],
"40": [
"40.png"
],
"41": [
"41.png"
],
"45": [
"45.png"
],
"48": [
"48.png"
],
"49": [
"49.png"
],
"5": [
"5.png"
],
"53": [
"53.png"
],
"56": [
"56.png"
],
"59": [
"59.png"
],
"6": [
"6.png"
],
"62": [
"62.png"
],
"65": [
"65.png"
],
"68": [
"68.png"
],
"7": [
"7.png"
],
"71": [
"71.png"
],
"76": [
"76.png"
],
"77": [
"77.png"
],
"78": [
"78.png"
],
"81": [
"81.png"
],
"action24": [
"000000.png",
"000001.png",
"000002.png",
"000003.png",
"000004.png",
"000005.png",
"000006.png",
"000007.png",
"000008.png",
"000009.png",
"000010.png",
"000011.png",
"000012.png",
"000013.png",
"000014.png",
"000015.png",
"000016.png",
"000017.png",
"000018.png",
"000019.png",
"000020.png",
"000021.png",
"000022.png",
"000023.png",
"000024.png"
]
}
@@ -21,7 +21,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class MainActivity extends FaceActivity
{
@@ -30,13 +33,8 @@ public class MainActivity extends FaceActivity
protected void onCreate(Bundle savedInstanceState)
{
Motion motion = new Motion();
motion.type = "底妆";
motion.technique = "基础上妆";
motion.step = "2按压";
motion.show_type = "方向示意图";
motion.png_name = "4.png";
motion.png_num = 1;
motion.type = "4";
motion.png_names.add("4.png");
InitArg initArg = new InitArg();
initArg.action_fps = 3;
initArg.zoom = 1.5f;
@@ -52,8 +50,7 @@ public class MainActivity extends FaceActivity
String GetCurMotionState(int index)
{
Motion motion = new Motion();
motion.png_name = pngFilenames.get(index);
motion.png_num = 1;
motion.png_names = pngFilesByFolder.get(index).getFileList();
return motion.toJson();
}
@@ -77,26 +74,38 @@ public class MainActivity extends FaceActivity
// 手指抬起
Log.d("TouchEvent", "手指抬起");
curIndex++;
if(curIndex > pngFilenames.size()-1)
if(curIndex > pngFilesByFolder.size()-1)
{
curIndex = 0;
}
ChangeState(GetCurMotionState(curIndex));
Toast.makeText(this, pngFilenames.get(curIndex), Toast.LENGTH_LONG).show();
Toast.makeText(this, pngFilesByFolder.get(curIndex).folderName, Toast.LENGTH_LONG).show();
break;
}
return true; // 表示已处理该事件
}
List<String> pngFilenames = null;
int curIndex = 0;
private void FaceInit(Context context){
pngFilenames = readPngFilenamesFromAssets(context, "pic/png_filenames.json");
private class FolderInfo {
private String folderName;
private List<String> fileList;
public FolderInfo(String folderName, List<String> fileList) {
this.folderName = folderName;
this.fileList = fileList;
}
public String getFolderName() {
return folderName;
}
public List<String> getFileList() {
return fileList;
}
}
private List<String> readPngFilenamesFromAssets(Context context, String filename) {
List<String> pngFilenames = new ArrayList<>();
private List<FolderInfo> readPngFilenamesFromAssets(Context context, String filename) {
List<FolderInfo> folderList = new ArrayList<>();
try {
InputStream is = context.getAssets().open(filename);
@@ -107,9 +116,20 @@ public class MainActivity extends FaceActivity
stringBuilder.append(line);
}
JSONArray jsonArray = new JSONArray(stringBuilder.toString());
for (int i = 0; i < jsonArray.length(); i++) {
pngFilenames.add(jsonArray.getString(i));
JSONObject jsonObject = new JSONObject(stringBuilder.toString());
// 遍历所有文件夹
Iterator<String> folderIterator = jsonObject.keys();
while (folderIterator.hasNext()) {
String folderName = folderIterator.next();
JSONArray fileArray = jsonObject.getJSONArray(folderName);
List<String> filesInFolder = new ArrayList<>();
for (int i = 0; i < fileArray.length(); i++) {
filesInFolder.add(fileArray.getString(i));
}
folderList.add(new FolderInfo(folderName, filesInFolder));
}
reader.close();
@@ -118,6 +138,12 @@ public class MainActivity extends FaceActivity
e.printStackTrace();
}
return pngFilenames;
return folderList;
}
int curIndex = 0;
List<FolderInfo> pngFilesByFolder = null;
private void FaceInit(Context context){
pngFilesByFolder = readPngFilenamesFromAssets(context, "pic/motion_data.json");
}
}