ui: more 3d for raised widgets

This commit is contained in:
jean-emmanuel 2017-07-16 22:42:05 +02:00
parent 49f3c51b0a
commit 9d53643312
8 changed files with 32 additions and 13 deletions

View file

@ -262,7 +262,7 @@ module.exports = class Fader extends _sliders_base {
this.ctx.beginPath()
this.ctx.rect(m - 9 * PXSCALE, d - 15 * PXSCALE, 18 * PXSCALE, 30 * PXSCALE)
this.ctx.lineWidth = PXSCALE
this.ctx.fillStyle = this.colors.track
this.ctx.fillStyle = this.colors.bg
this.ctx.fill()
this.ctx.beginPath()
@ -277,6 +277,12 @@ module.exports = class Fader extends _sliders_base {
this.ctx.strokeStyle = this.colors.light
this.ctx.stroke()
this.ctx.beginPath()
this.ctx.rect(m - 8 * PXSCALE, d - 14 * PXSCALE, 16 * PXSCALE, PXSCALE)
this.ctx.lineWidth = PXSCALE
this.ctx.fillStyle = this.colors.light
this.ctx.fill()
this.ctx.beginPath()
this.ctx.rect(m - 4 * PXSCALE, d, 8 * PXSCALE, PXSCALE)
this.ctx.fillStyle = this.colors.knob

View file

@ -137,6 +137,8 @@ module.exports = class Knob extends _sliders_base {
draw() {
if (!this.width || !this.height) return
var tiny = this.minDimension < 45,
margin = tiny ? 0 : 5 * PXSCALE
@ -145,7 +147,7 @@ module.exports = class Knob extends _sliders_base {
min = this.percentToAngle(0),
max = this.percentToAngle(100),
dashed = this.getProp('dashed'),
pipsWidth = this.getProp('pips') ? 3 * PXSCALE : 0,
pipsWidth = this.getProp('pips') && !tiny ? 3 * PXSCALE : 0,
pipsRadius = this.minDimension / 2 - pipsWidth / 2 - margin,
gaugeWidth = 7 * PXSCALE,
gaugeRadius = pipsRadius - gaugeWidth / 2 - pipsWidth * 1.5,
@ -205,7 +207,7 @@ module.exports = class Knob extends _sliders_base {
if (dashed) this.ctx.setLineDash([1.5, 1.5])
this.ctx.strokeStyle = this.colors.track
this.ctx.strokeStyle = tiny ? this.colors.light : this.colors.track
this.ctx.lineWidth = gaugeWidth - 4.5 * PXSCALE
this.ctx.beginPath()
this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max)
@ -239,6 +241,13 @@ module.exports = class Knob extends _sliders_base {
this.ctx.strokeStyle = this.colors.light
this.ctx.stroke()
var g = this.ctx.createLinearGradient(this.width / 2, this.height / 2 - knobRadius / 2,this.width / 2, this.height / 2 + knobRadius / 2);
g.addColorStop(0.5, 'transparent');
g.addColorStop(0, this.colors.light);
this.ctx.strokeStyle = g
this.ctx.stroke()
// cursor
this.ctx.globalAlpha = 1

View file

@ -149,7 +149,7 @@
white-space: nowrap;
border-top:1rem solid var(--color-fg);
resize: none;
font-size: 12rem!important;
font-size: 12rem!important;
}
.error label{
border-right: 1rem solid rgba(red, .75);

View file

@ -100,7 +100,7 @@ body {
left: 0;
right: 0;
bottom: 0;
opacity: 0.35;
opacity: 0.4;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
&:before {

View file

@ -103,7 +103,7 @@
left: 0;
right: 0;
bottom: 0;
opacity: 0.35;
opacity: 0.4;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
&:before {

View file

@ -10,7 +10,7 @@
left: 0;
right: 0;
bottom: 0;
opacity: 0.35;
opacity: 0.4;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
}

View file

@ -59,7 +59,8 @@
display: flex;
flex-direction: column;
justify-content: center;
box-shadow: 0 0 0 1rem var(--color-light) inset;
box-shadow: 0 0 0 1rem var(--color-light) inset,
0 1rem 0 0 var(--color-light) inset;
&:before {
content:"";
@ -83,7 +84,7 @@
left: 0;
right: 0;
bottom: 0;
opacity: 0.35;
opacity: 0.4;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
&:before {
@ -167,6 +168,8 @@
position: relative;
overflow: hidden;
cursor: pointer;
box-shadow: 0 0 0 1rem var(--color-light) inset;
select {
display: block;
width: 100%;
@ -174,7 +177,6 @@
display: flex;
vertical-align: middle;
background:transparent;
border: 1rem solid var(--color-light);
padding: 0 20rem 0 10rem;
-webkit-appearance:none;
appearance:none;

View file

@ -18,7 +18,8 @@
content:"";
flex:1;
opacity: 1;
box-shadow: 0 0 0 1rem var(--color-light) inset;
box-shadow: 0 0 0 1rem var(--color-light) inset,
0 1rem 0 0 var(--color-light) inset;
border-radius: inherit;
}
@ -30,7 +31,7 @@
left: 0;
right: 0;
bottom: 0;
opacity: 0.35;
opacity: 0.4;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
@ -83,9 +84,10 @@
box-shadow: 0 0 0 1rem var(--color-light), 0 0 0 1rem var(--color-bg) inset;
z-index: 1;
border-radius: inherit;
opacity: 0.7;
opacity: 0.9;
}
.toggle.on:after {
opacity: 0.7;
background: var(--color-custom);
}
.toggle:before {