0.8.6: clip instances get stage transforms (x/y/scale/rotation)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
53c0410824
commit
d60684edd1
7 files changed
+512
-41
No files matched your search
+13
-1
@@ -1,6 +1,6 @@
|
||||
import type { Scene } from '@/types/scene'
|
||||
|
||||
const RUNTIME_VERSION = '15'
|
||||
const RUNTIME_VERSION = '17'
|
||||
|
||||
const ENGINE_SOURCE = `(function(){
|
||||
if (window.AnimatrPlayer && window.AnimatrPlayer.__v === '${RUNTIME_VERSION}') return;
|
||||
@@ -732,9 +732,21 @@ const ENGINE_SOURCE = `(function(){
|
||||
var offset=time-inst2.startTime;
|
||||
if(offset<0||offset>visibleClip)continue;
|
||||
var localT=tS+offset;
|
||||
var ix2=inst2.x||0, iy2=inst2.y||0;
|
||||
var isx2=(inst2.scaleX==null?1:inst2.scaleX);
|
||||
var isy2=(inst2.scaleY==null?1:inst2.scaleY);
|
||||
var irot2=inst2.rotation||0;
|
||||
var needsXf=ix2!==0||iy2!==0||isx2!==1||isy2!==1||irot2!==0;
|
||||
if(needsXf){
|
||||
ctx.save();
|
||||
ctx.translate(ix2,iy2);
|
||||
if(irot2!==0) ctx.rotate(irot2*Math.PI/180);
|
||||
ctx.scale(isx2,isy2);
|
||||
}
|
||||
for(var cl2=clip2.layers.length-1;cl2>=0;cl2--){
|
||||
drawLayer(clip2.layers[cl2],localT);
|
||||
}
|
||||
if(needsXf) ctx.restore();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -446,7 +446,21 @@ export function drawSceneFrame(
|
||||
const visible = Math.max(0, clip.duration - trimStart - trimEnd)
|
||||
const offsetIntoBlock = time - inst.startTime
|
||||
if (offsetIntoBlock < 0 || offsetIntoBlock > visible) continue
|
||||
const ix = inst.x ?? 0
|
||||
const iy = inst.y ?? 0
|
||||
const isx = inst.scaleX ?? 1
|
||||
const isy = inst.scaleY ?? 1
|
||||
const irot = inst.rotation ?? 0
|
||||
const needsTransform =
|
||||
ix !== 0 || iy !== 0 || isx !== 1 || isy !== 1 || irot !== 0
|
||||
if (needsTransform) {
|
||||
drawCtx.save()
|
||||
drawCtx.translate(ix, iy)
|
||||
if (irot !== 0) drawCtx.rotate((irot * Math.PI) / 180)
|
||||
drawCtx.scale(isx, isy)
|
||||
}
|
||||
drawLayers(drawCtx, clip.layers, assetMap, images, trimStart + offsetIntoBlock)
|
||||
if (needsTransform) drawCtx.restore()
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user