diff options
| author | s-ol <s+removethis@s-ol.nu> | 2022-02-04 16:29:51 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | ce2566741e64e37947f35c9e69e124c6b15d5630 (patch) | |
| tree | 4667acb215d4dbeea2c8af1e61a1ad34ef385e91 | |
| parent | lib: fix array-/map (diff) | |
| download | alive-ce2566741e64e37947f35c9e69e124c6b15d5630.tar.gz alive-ce2566741e64e37947f35c9e69e124c6b15d5630.zip | |
examples: more smoothing in love example :)
| -rw-r--r-- | examples/love.alv | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/examples/love.alv b/examples/love.alv index ca71a84..71a8287 100644 --- a/examples/love.alv +++ b/examples/love.alv @@ -3,24 +3,26 @@ The size changes when the left mouse button is held, and the color changes when space is pressed. ) -([1]import* love math time) +([1]import* love math time array-) -([32]trace ([33]mouse-releases)) - -#(cycle colors when space is prssed) -([20]def fill-color - ([21]switch ([22]key-presses "space") +([20]def + #(cycle colors when space is pressed) + fill-color ([21]switch ([22]key-presses "space") ([23]array 0.3 0 0.9) ([24]array 0 0.9 0.3) ([27]array 0.9 0.3 0) ([28]array 0.3 0.9 0) ([30]array 0 0.3 0.9) - ([31]array 0.9 0 0.3))) + ([31]array 0.9 0 0.3)) + + #(smooth out rgb channels individually) + smooth-color ([36]map fill-color + ([32]fn (i) ([33]smooth 0.1 i)))) ([2]draw ([3]->> ([8]rectangle 'fill' 100 100) - ([14]color fill-color) - ([15]scale ([16]switch ([17]mouse-down? 1) 0.5 1)) + ([14]color smooth-color) + ([15]scale ([34]smooth 0.2 ([16]switch ([17]mouse-down? 1) 0.5 1))) ([5]rotate ([9]ramp 2 tau)) #(rotate tau (2*PI) every 2 seconds) ([4]translate ([10]mouse-pos) #(move to mouse cursor) ))) |
