mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 12:38:35 +00:00
more settings
This commit is contained in:
parent
8a3e9171a4
commit
539160630d
@ -1,4 +1,4 @@
|
|||||||
import { Pattern, midiToFreq } from '@strudel/core';
|
import { Pattern, midiToFreq, getFrequency } from '@strudel/core';
|
||||||
import { getTheme, getDrawContext } from './draw.mjs';
|
import { getTheme, getDrawContext } from './draw.mjs';
|
||||||
|
|
||||||
const c = midiToFreq(36);
|
const c = midiToFreq(36);
|
||||||
@ -21,19 +21,20 @@ export function pitchwheel({
|
|||||||
id,
|
id,
|
||||||
connectdots = 0,
|
connectdots = 0,
|
||||||
centerlines = 1,
|
centerlines = 1,
|
||||||
|
hapcircles = 1,
|
||||||
circle = 0,
|
circle = 0,
|
||||||
edo = 12,
|
edo = 12,
|
||||||
root = c,
|
root = c,
|
||||||
|
thickness = 4,
|
||||||
|
hapRadius = 4,
|
||||||
|
margin = 10,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
const w = ctx.canvas.width;
|
const w = ctx.canvas.width;
|
||||||
const h = ctx.canvas.height;
|
const h = ctx.canvas.height;
|
||||||
ctx.clearRect(0, 0, w, h);
|
ctx.clearRect(0, 0, w, h);
|
||||||
const color = getTheme().foreground;
|
const color = getTheme().foreground;
|
||||||
const hapRadius = 10;
|
|
||||||
const margin = 10;
|
|
||||||
|
|
||||||
const size = Math.min(w, h);
|
const size = Math.min(w, h);
|
||||||
const thickness = 4;
|
|
||||||
const radius = size / 2 - thickness / 2 - hapRadius - margin;
|
const radius = size / 2 - thickness / 2 - hapRadius - margin;
|
||||||
const centerX = w / 2;
|
const centerX = w / 2;
|
||||||
const centerY = h / 2;
|
const centerY = h / 2;
|
||||||
@ -74,9 +75,11 @@ export function pitchwheel({
|
|||||||
const { velocity = 1, gain = 1 } = hap.value || {};
|
const { velocity = 1, gain = 1 } = hap.value || {};
|
||||||
ctx.globalAlpha = velocity * gain;
|
ctx.globalAlpha = velocity * gain;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(x + hapRadius, y);
|
if (hapcircles) {
|
||||||
ctx.arc(x, y, hapRadius, 0, 2 * Math.PI);
|
ctx.moveTo(x + hapRadius, y);
|
||||||
ctx.fill();
|
ctx.arc(x, y, hapRadius, 0, 2 * Math.PI);
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
if (centerlines) {
|
if (centerlines) {
|
||||||
ctx.moveTo(centerX, centerY);
|
ctx.moveTo(centerX, centerY);
|
||||||
ctx.lineTo(x, y);
|
ctx.lineTo(x, y);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user