Commit 86196e48 authored by wjf's avatar wjf

l

parent 3e032468
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -161,17 +161,9 @@ export class MovieClip extends egret.DisplayObjectContainer { ...@@ -161,17 +161,9 @@ export class MovieClip extends egret.DisplayObjectContainer {
for (var i = 0, len = sprites.length; i < len; i++) { for (var i = 0, len = sprites.length; i < len; i++) {
var ele = sprites[i]; var ele = sprites[i];
if (ele.imageKey) { if (ele.imageKey) {
var child var child = new egret.Bitmap(this.textures[ele.imageKey]);
var splitArr = ele.imageKey.split("_"); //加个名字,暂时用imageKey,如果有一致的imageKey,会覆盖
//需要标记的,预留其他类型 this[ele.imageKey] = child;
if (splitArr[1] && splitArr[1] == "spr") {
child = new egret.Bitmap(this.textures[ele.imageKey]);
this[splitArr[0]] = child;
}
//一般不需要标记的
else {
child = new egret.Bitmap(this.textures[ele.imageKey]);
}
//透明度处理 //透明度处理
if (ele.frames[0].alpha < 0.05) { if (ele.frames[0].alpha < 0.05) {
child.visible = false; child.visible = false;
......
...@@ -67,34 +67,47 @@ ...@@ -67,34 +67,47 @@
function aaa(videoItem) { function aaa(videoItem) {
var obj = {}; var obj = {};
//帧率 60 30 等
obj.FPS = videoItem.FPS; obj.FPS = videoItem.FPS;
//帧数 81等
obj.frames = videoItem.frames; obj.frames = videoItem.frames;
//尺寸
obj.videoSize = videoItem.videoSize; obj.videoSize = videoItem.videoSize;
//所有的部件
obj.sprites = []; obj.sprites = [];
for (var i = 0; i < videoItem.sprites.length; i++) { for (var i = 0; i < videoItem.sprites.length; i++) {
var sprite = videoItem.sprites[i]; var sprite = videoItem.sprites[i];
var s = {}; var s = {};
//图片键值
s.imageKey = sprite.imageKey; s.imageKey = sprite.imageKey;
//动画帧数据组
s.frames = []; s.frames = [];
for (var j = 0; j < sprite.frames.length; j++) { for (var j = 0; j < sprite.frames.length; j++) {
var frame = sprite.frames[j]; var frame = sprite.frames[j];
var f = {}; var f = {};
f.alpha = frame.alpha; //透明度
f.alpha = cutFour(frame.alpha);
//矩阵数据,考虑用对象还是数组
f.transform = [ f.transform = [
frame.transform.a, cutFour(frame.transform.a),
frame.transform.b, cutFour(frame.transform.b),
frame.transform.c, cutFour(frame.transform.c),
frame.transform.d, cutFour(frame.transform.d),
frame.transform.tx, cutFour(frame.transform.tx),
frame.transform.ty, cutFour(frame.transform.ty),
]; ];
s.frames.push(f) s.frames.push(f)
} }
obj.sprites.push(s) obj.sprites.push(s)
} }
// obj.sprites = videoItem.sprites
return obj return obj
} }
function cutFour(number) {
var reg = /^(.*\..{4}).*$/;
var temp = String(number).replace(reg, "$1");
return Number(temp);
}
</script> </script>
</body> </body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment