From 9ba8e90d93dced691fa870e98f534ff2cb454c32 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 13 Nov 2021 18:13:20 +0100 Subject: lib: filter arguments for love event streams --- examples/love.alv | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'examples') 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) +))) -- cgit v1.2.3