show animation speed

This commit is contained in:
Stewart Allen 2020-11-29 10:04:13 -05:00
commit b1c8feb319
4 changed files with 34 additions and 10 deletions

View file

@ -4,7 +4,6 @@
* `cnc`
* - tracing (chamfer, engrave)
* - auto feature detection (slicing)
* - show 1x, 2x, 4x speed in animation
* `laser`
* - drag knife support
* `all`
@ -20,6 +19,8 @@
# - redo automatic supports using faces instead of deltas
# - bind process to z ranges or boxed regions
# - non-planar actual
# `all`
# - improve device list, selection, management, customization
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix

View file

@ -1278,7 +1278,7 @@
tracker = $('tracker'),
controller = settings().controller;
// UC.setHoverPop(controller.hoverPop);
UC.setHoverPop(false);
WIN.addEventListener("resize", () => {
API.event.emit('resize');

View file

@ -8,7 +8,10 @@ self.kiri.loader.push(function() {
CAM = KIRI.driver.CAM,
API, WORLD, SPACE,
meshes = {},
speedDef = 20,
speedValues = [ 25, 12, 6, 3 ],
speedNames = [ "1x", "2x", "4x", "8x" ],
speedIndex = 0,
speedLabel,
speed;
// ---( CLIENT FUNCTIONS )---
@ -36,19 +39,28 @@ self.kiri.loader.push(function() {
layer.innerHTML = '';
UC.setGroup(layer);
UC.newRow([
UC.newButton(null,replay,{icon:'<i class="fas fa-step-backward"></i>'}),
UC.newButton(null,replay,{icon:'<i class="fas fa-fast-backward"></i>'}),
UC.newButton(null,play,{icon:'<i class="fas fa-play"></i>'}),
UC.newButton(null,step,{icon:'<i class="fas fa-step-forward"></i>'}),
UC.newButton(null,fast,{icon:'<i class="fas fa-forward"></i>'}),
UC.newButton(null,pause,{icon:'<i class="fas fa-pause"></i>'})
UC.newButton(null,fast,{icon:'<i class="fas fa-fast-forward"></i>'}),
UC.newButton(null,pause,{icon:'<i class="fas fa-pause"></i>'}),
speedLabel = UC.newLabel("speed")
]);
speed = speedDef;
updateSpeed();
setTimeout(() => {
play({steps: 1});
}, delay || 0);
});
};
function updateSpeed(inc = 0) {
if (inc > 0) {
speedIndex = (speedIndex + inc) % speedValues.length;
}
speed = speedValues[speedIndex];
speedLabel.innerText = speedNames[speedIndex];
}
function replay() {
CAM.animate_clear(API);
setTimeout(() => {
@ -118,19 +130,19 @@ self.kiri.loader.push(function() {
function step(opts) {
const { steps } = opts;
updateSpeed();
KIRI.client.animate({speed, steps: 1}, handleGridUpdate);
}
function play(opts) {
const { steps } = opts;
speed = speedDef;
updateSpeed();
KIRI.client.animate({speed, steps: steps || Infinity}, handleGridUpdate);
}
function fast(opts) {
const { steps } = opts;
speed = speed / 2;
if (speed < 5) speed = speedDef;
updateSpeed(1);
KIRI.client.animate({speed, steps: steps || Infinity}, handleGridUpdate);
}

View file

@ -888,6 +888,17 @@ th, tr, td, label {
color: #333;
font-size: 30px;
}
#layer-animate label {
display: inline-flex;
width: 30px;
border-radius: 3px;
border: 1px solid #aaa;
margin: 1px 2px 2px 4px;
justify-content: center;
align-items: center;
font-weight: bold;
background-color: #ddd;
}
#slider {
display: none;