Commit 6324cf44 authored by wjf's avatar wjf

l

parent f0ca8420
...@@ -550,8 +550,25 @@ function getAsset(source, compFunc, thisObject) { ...@@ -550,8 +550,25 @@ function getAsset(source, compFunc, thisObject) {
} }
function deepCopyFrames(frames, tx, ty, scaleX = 1, scaleY = 1) { function deepCopyFrames(
frames,
x,
y,
scaleX = 1,
scaleY = 1,
rotation = 0,
anchorX = 0,
anchorY = 0
) {
var cf = []; var cf = [];
rotation *= Math.PI / 180;
var lt = {};
lt.a = Math.cos(rotation) * scaleX;
lt.b = Math.sin(rotation) * scaleX;
lt.c = -Math.sin(rotation) * scaleY;
lt.d = Math.cos(rotation) * scaleY;
lt.tx = x + anchorX - ((anchorX * lt.a) + (anchorY * lt.c));
lt.ty = y + anchorY - ((anchorX * lt.b) + (anchorY * lt.d));
for (var j = 0; j < frames.length; j++) { for (var j = 0; j < frames.length; j++) {
var frame = frames[j]; var frame = frames[j];
const pt = frame.transform; const pt = frame.transform;
...@@ -559,12 +576,12 @@ function deepCopyFrames(frames, tx, ty, scaleX = 1, scaleY = 1) { ...@@ -559,12 +576,12 @@ function deepCopyFrames(frames, tx, ty, scaleX = 1, scaleY = 1) {
//透明度 //透明度
f.alpha = frame.alpha; f.alpha = frame.alpha;
f.transform = { f.transform = {
a: scaleX * pt.a, a: (lt.a * pt.a) + (lt.b * pt.c),
b: scaleX * pt.b, b: (lt.a * pt.b) + (lt.b * pt.d),
c: scaleY * pt.c, c: (lt.c * pt.a) + (lt.d * pt.c),
d: scaleY * pt.d, d: (lt.c * pt.b) + (lt.d * pt.d),
tx: (tx * pt.a) + (ty * pt.c) + pt.tx, tx: (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx,
ty: (tx * pt.b) + (ty * pt.d) + pt.ty, ty: (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty,
}; };
cf.push(f) cf.push(f)
} }
......
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