add some platform tween effects

This commit is contained in:
Stewart Allen 2021-02-10 20:11:03 -05:00
commit d2487f1b08
2 changed files with 40 additions and 11 deletions

View file

@ -393,8 +393,10 @@
// sparse layers only present when non-vase mose and sparse % > 0
if (doSparseFill && !isSynth) {
let lastType;
forSlices(0.5, 0.7, slice => {
let params = getRangeParameters(settings, slice.index);
let newType = params.sliceFillType;
doSparseLayerFill(slice, {
settings: settings,
process: spro,
@ -404,9 +406,10 @@
density: params.sliceFillSparse,
bounds: widget.getBoundingBox(),
height: sliceHeight,
type: params.sliceFillType,
cache: params._range !== true
type: newType,
cache: params._range !== true && lastType === newType
});
lastType = newType;
}, "infill");
} else if (isSynth && supportDensity) {
forSlices(0.5, 0.7, slice => {

View file

@ -21,6 +21,8 @@
panZ = 0,
home = 0,
gridZOff = 0,
tweenTime = 500,
tweenDelay = 20,
platformZOff = 0,
perspective = 35,
refreshTimeout = null,
@ -142,7 +144,7 @@
function tweenit() {
TWEEN.update();
setTimeout(tweenit, 20);
setTimeout(tweenit, tweenDelay);
}
tweenit();
@ -173,12 +175,13 @@
}
}
new TWEEN.Tween(from).
to(to, 500).
to(to, tweenTime).
onUpdate(tf).
onComplete(() => {
viewControl.setPosition(pos);
updateLastAction();
refresh();
if (pos.then) pos.then();
}).
start();
}
@ -198,7 +201,7 @@
setGrid();
};
new TWEEN.Tween(from).
to(to, 500).
to(to, tweenTime).
onStart(start).
onUpdate(update).
onComplete(complete).
@ -939,12 +942,12 @@
},
view: {
top: function() { tweenCam({left: home, up: 0, panX, panY, panZ}) },
back: function() { tweenCam({left: PI, up: PI2, panX, panY, panZ}) },
home: function() { tweenCam({left: home, up: PI4, panX, panY, panZ}) },
front: function() { tweenCam({left: 0, up: PI2, panX, panY, panZ}) },
right: function() { tweenCam({left: PI2, up: PI2, panX, panY, panZ}) },
left: function() { tweenCam({left: -PI2, up: PI2, panX, panY, panZ}) },
top: function(then) { tweenCam({left: home, up: 0, panX, panY, panZ, then}) },
back: function(then) { tweenCam({left: PI, up: PI2, panX, panY, panZ, then}) },
home: function(then) { tweenCam({left: home, up: PI4, panX, panY, panZ, then}) },
front: function(then) { tweenCam({left: 0, up: PI2, panX, panY, panZ, then}) },
right: function(then) { tweenCam({left: PI2, up: PI2, panX, panY, panZ, then}) },
left: function(then) { tweenCam({left: -PI2, up: PI2, panX, panY, panZ, then}) },
reset: function() { viewControl.reset(); requestRefresh() },
load: function(cam) { viewControl.setPosition(cam) },
save: function() { return viewControl.getPosition(true) },
@ -965,6 +968,21 @@
},
setHome: function(r) {
home = r || 0;
},
spin: function(then, count) {
Space.view.front(() => {
Space.view.right(() => {
Space.view.back(() => {
Space.view.left(() => {
if (--count > 0) {
Space.view.spin(then, count);
} else {
Space.view.front(then);
}
});
});
});
});
}
},
@ -985,6 +1003,14 @@
selectRecurse = b;
},
setTweenTime: function(t) {
tweenTime = t || 500;
},
setTweenDelay: function(d) {
tweenDelay = d || 20;
},
objects: function() {
return WC;
},