use l5 colorLerp and color fns
This commit is contained in:
parent
580218dac4
commit
b4f9aaa39f
2 changed files with 5 additions and 8 deletions
11
main.fnl
11
main.fnl
|
|
@ -4,11 +4,8 @@
|
|||
(size 640 480)
|
||||
(textSize 100))
|
||||
|
||||
(local colors {
|
||||
:yellow [255 228 112] ; #ffe470
|
||||
:dark [64 56 48] ; #403830
|
||||
})
|
||||
|
||||
(local yellow (color 255 228 112)) ; #ffe470
|
||||
(local dark (color 64 56 48)) ; #403830
|
||||
(local steps (* 24 60))
|
||||
(var step 0)
|
||||
|
||||
|
|
@ -32,8 +29,8 @@
|
|||
(let [
|
||||
half (/ steps 2)
|
||||
color-step (if (> step half) (- half (- step half)) step)
|
||||
color-fn #(+ (. colors.dark $1) (* (/ (- (. colors.yellow $1) (. colors.dark $1)) half) color-step))]
|
||||
(background (color-fn 1) (color-fn 2) (color-fn 3)))
|
||||
current-color (lerpColor dark yellow (map color-step 0 half 0 1))]
|
||||
(background current-color))
|
||||
(text (time step) 175 150)
|
||||
(text (time goal-time) 175 250)
|
||||
(when (and pause (= goal-time step)) (set won true))
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
(def built-ins #{"fn" "local" "λ" "lambda" "require" "let" "+" "-" "/" "*" "<" ">" "<=" ">=" "not=" ".."
|
||||
"var" "if" "when" "and" "or" "not" "do" "set" "each" "for" "while"
|
||||
"true" "$1" "math.floor" "floor" "false" "nil" "size" "textSize" "background" "text" "random" "key"
|
||||
":setup" ":draw" ":key-pressed" ":L5" "map"})
|
||||
":setup" ":draw" ":key-pressed" ":L5" "map" "color" "lerpColor"})
|
||||
|
||||
(defn collect-bindings [tokens]
|
||||
(reduce (fn [acc token]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue