Skip to content

Commit

Permalink
code doc improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
katestange committed Nov 26, 2024
1 parent 5090b8e commit f726d5f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/visualizers/ModFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ to apply the highlight color (residue 0) or fill color (residue 1). Default:
+ '(number) or true (boolean), draws residue of '
+ 'a(n) in the highlight color. For example, try '
+ 'isPrime(n) to highlight terms of prime index, or '
+ 'n to highlight terms of odd index.',
+ 'a to highlight terms of odd value.',
visibleValue: true,
required: false,
},
Expand Down Expand Up @@ -191,7 +191,6 @@ class ModFill extends P5Visualizer(paramDesc) {
for (let mod = 1; mod <= this.useMod; mod++) {
// determine alpha
const value = this.seq.getElement(num)
// needs to take BigInt when implemented
const vars = this.highlightFormula.freevars
let useNum = 0
let useValue = 0
Expand All @@ -203,13 +202,15 @@ class ModFill extends P5Visualizer(paramDesc) {
if (vars.includes('a')) {
useValue = math.safeNumber(value)
}
// needs to take BigInt when implemented
const high = this.highlightFormula.compute(useNum, useValue)
if (Number(math.modulo(high, 2)) === 1) {
drawColor = this.useHighColor
alphaFormula = this.alphaHigh
}

drawColor.setAlpha(255 * alphaFormula.compute(mod))

// draw rectangle
this.sketch.fill(drawColor)
const x = (mod - 1) * this.rectWidth + this.offsetX
const y =
Expand Down

0 comments on commit f726d5f

Please sign in to comment.