In this example, ZIM BITS - Damping and Easing for JavaScript HTML 5 Canvas and CreateJS - Tips, Techniques and Tutorials
how can we know if ZIM Slider was slide up or down?
The Slider slides left to right if vertical is false (horizontal) and slides bottom to top if the vertical is set. So lower numbers at bottom like a vertical volume slider. Not sure if that answers your question. I find that if I want a vertical slider to go lower at the top and higher at the bottom (which I just wanted recently) that I use a horizontal slider and rot(90).pos(wherever).
In the example, sliding up will rotate objects clockwise and sliding down will rotate counterclockwise. Is it possible to detect if we start to slide up or down?
const label = new Label({text:"DIRECTION", align:CENTER})
.reg(CENTER)
.pos(0,100,CENTER);
const slider = new Slider({vertical:true}).center().change(()=>{
label.text = slider.currentValue > lastValue?"UP":"DOWN";
lastValue = slider.currentValue;
});
let lastValue = slider.currentValue;
2 Likes