knob: swaggify compact gauge (link alpha & distance to origin)

This commit is contained in:
jean-emmanuel 2016-11-22 18:51:29 +01:00
parent 4066f0446e
commit 70b3e71568

View file

@ -162,7 +162,7 @@ Knob.prototype.draw = function(){
this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - (this.gaugeWidth + this.margin) * PXSCALE, min, max)
this.ctx.stroke()
this.ctx.globalAlpha = 0.3
this.ctx.globalAlpha = 0.2 + 0.2 * Math.abs(d-o) / (d<o?o-min:max-o)
this.ctx.beginPath()
this.ctx.strokeStyle = this.colors.gauge
this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - (this.gaugeWidth + this.margin) * PXSCALE, Math.min(o,d), Math.max(o,d))
@ -174,6 +174,7 @@ Knob.prototype.draw = function(){
this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - (this.gaugeWidth/2 + this.margin) * PXSCALE, min, max)
this.ctx.stroke()
this.ctx.globalAlpha = 1
this.ctx.beginPath()