var Class = require('../../utils/Class'); var Axis = new Class({ initialize: function Axis(pad, index){ this.pad = pad; this.events = pad.events; this.index = index; this.value = 0; this.threshold = 0.05; } , update: function (value){ this.value = value; } , getValue: function (){ var percentage = (Math.abs(this.value) - this.threshold) / (1 - this.threshold); if (percentage < 0) { percentage = 0; } return percentage * (this.value > 0? 1: -1); } } ); module.exports = Axis;