Commit f0ca8420 authored by wjf's avatar wjf

l

parent 86196e48
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -165,11 +165,7 @@ export class MovieClip extends egret.DisplayObjectContainer { ...@@ -165,11 +165,7 @@ export class MovieClip extends egret.DisplayObjectContainer {
//加个名字,暂时用imageKey,如果有一致的imageKey,会覆盖 //加个名字,暂时用imageKey,如果有一致的imageKey,会覆盖
this[ele.imageKey] = child; this[ele.imageKey] = child;
//透明度处理 //透明度处理
if (ele.frames[0].alpha < 0.05) { child.alpha = ele.frames[0].alpha;
child.visible = false;
} else {
child.alpha = ele.frames[0].alpha;
}
child["frames"] = ele.frames; child["frames"] = ele.frames;
var transform = ele.frames[0].transform var transform = ele.frames[0].transform
child.matrix = new egret.Matrix().copyFrom(transform); child.matrix = new egret.Matrix().copyFrom(transform);
...@@ -461,15 +457,10 @@ export class MovieClip extends egret.DisplayObjectContainer { ...@@ -461,15 +457,10 @@ export class MovieClip extends egret.DisplayObjectContainer {
if (child["frames"] && child["frames"][s._curFrame - 1]) { if (child["frames"] && child["frames"][s._curFrame - 1]) {
var frame = child["frames"][s._curFrame - 1]; var frame = child["frames"][s._curFrame - 1];
//layout不晓得干嘛用,暂不管 //layout不晓得干嘛用,暂不管
if (frame.alpha < 0.05) { child.alpha = frame.alpha;
child.visible = false; //先判断transform是否相等
} else { if (!child.matrix.equals(frame.transform)) {
child.visible = true; child.matrix = new egret.Matrix().copyFrom(frame.transform);
child.alpha = frame.alpha;
//先判断transform是否相等
if (!child.matrix.equals(frame.transform)) {
child.matrix = new egret.Matrix().copyFrom(frame.transform);
}
} }
} }
} }
...@@ -556,4 +547,26 @@ function getAsset(source, compFunc, thisObject) { ...@@ -556,4 +547,26 @@ function getAsset(source, compFunc, thisObject) {
else { else {
RES.getResByUrl(source, compFunc, thisObject, RES.ResourceItem.TYPE_IMAGE); RES.getResByUrl(source, compFunc, thisObject, RES.ResourceItem.TYPE_IMAGE);
} }
}
function deepCopyFrames(frames, tx, ty, scaleX = 1, scaleY = 1) {
var cf = [];
for (var j = 0; j < frames.length; j++) {
var frame = frames[j];
const pt = frame.transform;
var f = { alpha: 0, transform: null };
//透明度
f.alpha = frame.alpha;
f.transform = {
a: scaleX * pt.a,
b: scaleX * pt.b,
c: scaleY * pt.c,
d: scaleY * pt.d,
tx: (tx * pt.a) + (ty * pt.c) + pt.tx,
ty: (tx * pt.b) + (ty * pt.d) + pt.ty,
};
cf.push(f)
}
return cf;
} }
\ No newline at end of file
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