I think I found a solution
(I'm not sure if it's the correct way, but it seems to be working)
Within the render function (update)
if (Mouse.moving && Mouse.speed > 0) {
Mouse.speed -= Mouse.maxSpeed / 20;
Mouse.smooth();
}
Description of the Mouse object:
var Mouse = {
moving: false,
movingForward: null,
speed: 60,
timeOfSmooth: 2000, // maxTimeOfSmooth
wheelListener: function () {
_this = this;
_this.maxSpeed = _this.speed; // setting maxSpeed
document.addEventListener('mousewheel', onDocumentMouseWheel, false);
function onDocumentMouseWheel(event) {
_this.speed = _this.maxSpeed;
_this.moving = true;
if (event.wheelDeltaY >= 10) {
_this.movingForward = true;
} else {
_this.movingForward = false;
}
clearTimeout(_this.timeOut);
_this.timeOut = setTimeout(function () {
_this.moving = false;
}, _this.timeOfSmooth);
}
},
smooth: function () {
if (this.moving) {
if (_this.movingForward) {
Engine.camera.position.z -= _this.speed;
} else {
Engine.camera.position.z += _this.speed;
}
}
},
init: function () {
this.wheelListener();
}
};