How would you make a 2D KITT?

ok, take one on this task:

ZERO config for size of matrix, you might have to adjust speed/tail/timing but the original KITT has hard coded values that do the same.

I made it scan horizontal as KITT does so as well, but replace y with x, and it’ll do vertical scans.

Interested in input as what improvements could be made. Uses NO beforerender intentionally (I’m planning on using it for my multi-map code), so it’s meant to be pretty bulletproof and self contained.

Suggestions welcomed, also criticisms, bugs, and so on.

export var location
export var timing = .1
export var size = .1
export var decayrate = .98
var decay = array(pixelCount)

export function sliderTiming(v) {
  timing = v/10
}

export function sliderSize(v) {
  size = v/10
}

export function sliderTail(v) {
  decayrate = .9 + v/10
}

export function render2D(index,x,y) {
  location = wave(time(timing) * 2 - 1)
  if (abs(location - y) < size) {
    hsv(1, 1, 1)
    decay[index] = 1
  } else {
    decay[index] = max(0, decay[index] * decayrate)
    hsv(1,1,decay[index] * decay[index] * decay[index])
  }
}

main difference I see: KITT immediately bounces off the wall, this seems to stop at the wall then reverses. I suspect this can be improved, it’s a wave thing.

1 Like