0.10.4: button still-frames render only on their own state
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fcb8edbb88
commit
8895fc76ef
8 files changed
+311
-23
No files matched your search
+32
-5
@@ -10,7 +10,7 @@ function isProject(p: ExportPayload): p is Project {
|
||||
return Array.isArray((p as Partial<Project>).scenes)
|
||||
}
|
||||
|
||||
const RUNTIME_VERSION = '24'
|
||||
const RUNTIME_VERSION = '25'
|
||||
|
||||
const ENGINE_SOURCE = `(function(){
|
||||
if (window.AnimatrPlayer && window.AnimatrPlayer.__v === '${RUNTIME_VERSION}') return;
|
||||
@@ -660,11 +660,13 @@ const ENGINE_SOURCE = `(function(){
|
||||
}
|
||||
if(closed) tctx.closePath();
|
||||
}
|
||||
function drawMaskShape(ctxm,layer,time,alwaysActive){
|
||||
function drawMaskShape(ctxm,layer,time,buttonMode){
|
||||
var asset=assetMap[layer.assetId];
|
||||
if(!asset) return;
|
||||
if(asset.kind!=='rect' && asset.kind!=='circle' && asset.kind!=='text' && asset.kind!=='polygon') return;
|
||||
if(!alwaysActive && !layerActiveAt(layer,time)) return;
|
||||
if(buttonMode){
|
||||
if(!buttonLayerActiveAt(layer,time)) return;
|
||||
} else if(!layerActiveAt(layer,time)) return;
|
||||
var p=sample(layer,time);
|
||||
ctxm.save();
|
||||
ctxm.translate(p.x,p.y);
|
||||
@@ -719,10 +721,35 @@ const ENGINE_SOURCE = `(function(){
|
||||
var EPS=1e-6;
|
||||
return time>=mn-EPS && time<=mx+EPS;
|
||||
}
|
||||
function drawLayer(layer,time,alwaysActive){
|
||||
// Button-asset visibility: a still-frame (hold) kf shows ONLY on
|
||||
// its own state frame, not on the state frames that follow. Mirrors
|
||||
// isButtonLayerActiveAt in interpolate.ts.
|
||||
function buttonLayerActiveAt(layer,time){
|
||||
var EPS=1e-6;
|
||||
var kfs=[];
|
||||
var mk=layer.keyframes||[];
|
||||
for(var bki=0;bki<mk.length;bki++) kfs.push(mk[bki]);
|
||||
var pk=layer.positionKeyframes||[];
|
||||
for(var bkj=0;bkj<pk.length;bkj++) kfs.push(pk[bkj]);
|
||||
var rk=layer.rotationKeyframes||[];
|
||||
for(var bkl=0;bkl<rk.length;bkl++) kfs.push(rk[bkl]);
|
||||
if(!kfs.length) return true;
|
||||
kfs.sort(function(x,y){return x.time-y.time;});
|
||||
for(var bkm=0;bkm<kfs.length;bkm++){
|
||||
if(Math.abs(kfs[bkm].time-time)<EPS) return true;
|
||||
}
|
||||
for(var bkn=0;bkn<kfs.length-1;bkn++){
|
||||
var a=kfs[bkn], b=kfs[bkn+1];
|
||||
if(time>a.time+EPS && time<b.time-EPS) return !a.hold;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function drawLayer(layer,time,buttonMode){
|
||||
var asset=assetMap[layer.assetId];
|
||||
if(!asset||!layer.visible)return;
|
||||
if(!alwaysActive&&!layerActiveAt(layer,time))return;
|
||||
if(buttonMode){
|
||||
if(!buttonLayerActiveAt(layer,time)) return;
|
||||
} else if(!layerActiveAt(layer,time)) return;
|
||||
var p=sample(layer,time);
|
||||
ctx.save();
|
||||
ctx.globalAlpha=ctx.globalAlpha*p.opacity;
|
||||
|
||||
Reference in new issue
Block a user