mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Fixed slider updates so we don't burn up CPUs
This commit is contained in:
parent
e05eaef52f
commit
b112ef10d3
@ -110,7 +110,11 @@ var animationMixingDemo = function(loadingComplete, bgColor) {
|
|||||||
function render () {
|
function render () {
|
||||||
timeKeeper.update();
|
timeKeeper.update();
|
||||||
var delta = timeKeeper.delta * timeSlider.get();
|
var delta = timeKeeper.delta * timeSlider.get();
|
||||||
if (timeSliderLabel) timeSliderLabel.text(Math.round(timeSlider.get() * 100) + "%");
|
if (timeSliderLabel) {
|
||||||
|
var oldValue = timeSliderLabel[0].textContent;
|
||||||
|
var newValue = Math.round(timeSlider.get() * 100) + "%";
|
||||||
|
if (oldValue !== newValue) timeSliderLabel[0].textContent = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
var offset = bounds.offset;
|
var offset = bounds.offset;
|
||||||
var size = bounds.size;
|
var size = bounds.size;
|
||||||
|
|||||||
@ -114,7 +114,11 @@ var spritesheetDemo = function(loadingComplete, bgColor) {
|
|||||||
var delta = timeKeeper.delta;
|
var delta = timeKeeper.delta;
|
||||||
|
|
||||||
delta *= timeSlider.get();
|
delta *= timeSlider.get();
|
||||||
if (timeSliderLabel) timeSliderLabel.text(Math.round(timeSlider.get() * 100) + "%");
|
if (timeSliderLabel) {
|
||||||
|
var oldValue = timeSliderLabel[0].textContent;
|
||||||
|
var newValue = Math.round(timeSlider.get() * 100) + "%";
|
||||||
|
if (oldValue !== newValue) timeSliderLabel[0].textContent = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
var animationDuration = animationState.getCurrent(0).animation.duration;
|
var animationDuration = animationState.getCurrent(0).animation.duration;
|
||||||
playTime += delta;
|
playTime += delta;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user