Fixes in lambda/function definitions (body args). Cleanup of examples and decumentation. Added convenience methods for JS interop, lists and objects.
This commit is contained in:
@@ -2,17 +2,31 @@
|
||||
|
||||
(clear)
|
||||
|
||||
(defn glitch
|
||||
(rec)
|
||||
(if (gt rec 1)
|
||||
(
|
||||
(translate
|
||||
(rect (random 400) (random 400) (random 10) (random 10))
|
||||
(pos (random 400) (random 400)))
|
||||
(glitch (sub rec 1)))))
|
||||
|
||||
(import
|
||||
"../static/crystal.jpg"
|
||||
(import $path
|
||||
(rect 0 0 400 400))
|
||||
|
||||
(defn translate
|
||||
(source-rect dest-pos)
|
||||
(
|
||||
(paste
|
||||
(copy source-rect)
|
||||
(rect dest-pos:x dest-pos:y source-rect:w source-rect:h))))
|
||||
|
||||
(defn glitch
|
||||
(rec)
|
||||
(if
|
||||
(gt rec 1)
|
||||
(
|
||||
(translate
|
||||
(rect
|
||||
(random 1 400)
|
||||
(random 1 400)
|
||||
(random 1 10)
|
||||
(random 1 10))
|
||||
(pos
|
||||
(random 1 400)
|
||||
(random 1 400)))
|
||||
(glitch
|
||||
(sub rec 1)))))
|
||||
|
||||
(glitch 500)
|
||||
@@ -1,6 +1,12 @@
|
||||
; Normalize photo colors
|
||||
|
||||
(open $path 0.5)
|
||||
|
||||
;(pick (rect 0 0 100 100)) will return the average color
|
||||
;of 100x100px rectangle.
|
||||
;without extra arguments,
|
||||
;pick grabs the whole canvas by default,
|
||||
;and calculates the average color.
|
||||
(def average-color
|
||||
(pick))
|
||||
(pixels normalize average-color)
|
||||
@@ -1,4 +1,4 @@
|
||||
; saturate image
|
||||
(open "../static/crystal.jpg")
|
||||
(pixels
|
||||
(frame) saturation 12)
|
||||
(open $path)
|
||||
(pixels saturation 12
|
||||
(get-frame))
|
||||
@@ -2,7 +2,7 @@
|
||||
; drag an image on the window
|
||||
(open $path)
|
||||
;
|
||||
(pixels
|
||||
(rect 100 100 400 400) saturation 0)
|
||||
(pixels
|
||||
(rect 300 300 400 400) contrast 0.5)
|
||||
(pixels saturation 0
|
||||
(rect 100 100 400 400))
|
||||
(pixels contrast 0.5
|
||||
(rect 300 300 400 400))
|
||||
@@ -6,7 +6,7 @@
|
||||
(if
|
||||
(gt rec 0)
|
||||
(
|
||||
(import "../static/crystal.jpg"
|
||||
(import $path
|
||||
(rect
|
||||
(random 200)
|
||||
(random 200)
|
||||
|
||||
Reference in New Issue
Block a user