fix syntax

This commit is contained in:
2026-02-17 09:15:15 -06:00
parent f310c18b84
commit 4e1b63fd0e
52 changed files with 2169 additions and 1754 deletions

View File

@@ -181,24 +181,30 @@ ColorMap.Viridis = ColorMap.makemap({
Color.normalize(ColorMap);
ColorMap.sample = function(t, map = this) {
if (t < 0) return map[0]
if (t > 1) return map[1]
ColorMap.sample = function(t, map) {
var local_map = map || this
if (t < 0) return local_map[0]
if (t > 1) return local_map[1]
var keys = sorted(array(map))
var keys = sorted(array(local_map))
var lastkey = 0
var i = 0
var key = null
var b = null
var a = null
var tt = 0
for (var i = 0; i < length(keys); i++) {
var key = keys[i]
for (i = 0; i < length(keys); i++) {
key = keys[i]
if (t < key) {
var b = map[key]
var a = map[lastkey]
var tt = (t - lastkey) / (key - lastkey)
b = local_map[key]
a = local_map[lastkey]
tt = (t - lastkey) / (key - lastkey)
return a.lerp(b, tt)
}
lastkey = key
}
return map[1]
return local_map[1]
}
ColorMap.doc = {