diff options
| author | s-ol <s+removethis@s-ol.nu> | 2021-11-13 17:13:20 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | 9ba8e90d93dced691fa870e98f534ff2cb454c32 (patch) | |
| tree | de3830e9d810f9b483908a5f7198ece7d6ff4500 /examples | |
| parent | update examples (diff) | |
| download | alive-9ba8e90d93dced691fa870e98f534ff2cb454c32.tar.gz alive-9ba8e90d93dced691fa870e98f534ff2cb454c32.zip | |
lib: filter arguments for love event streams
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/love.alv | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/examples/love.alv b/examples/love.alv index 7158e60..ca71a84 100644 --- a/examples/love.alv +++ b/examples/love.alv @@ -1,7 +1,26 @@ +#( + This example draws a rotating rectangle that follows the mouse cursor. + The size changes when the left mouse button is held, and the color + changes when space is pressed. +) ([1]import* love math time) + +([32]trace ([33]mouse-releases)) + +#(cycle colors when space is prssed) +([20]def 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))) + ([2]draw ([3]->> ([8]rectangle 'fill' 100 100) - ([14]color 1 0 0) + ([14]color fill-color) ([15]scale ([16]switch ([17]mouse-down? 1) 0.5 1)) - ([5]rotate ([9]ramp 2 tau)) - ([4]translate ([10]mouse-pos)))) + ([5]rotate ([9]ramp 2 tau)) #(rotate tau (2*PI) every 2 seconds) + ([4]translate ([10]mouse-pos) #(move to mouse cursor) +))) |
