From ce2566741e64e37947f35c9e69e124c6b15d5630 Mon Sep 17 00:00:00 2001 From: s-ol Date: Fri, 4 Feb 2022 17:29:51 +0100 Subject: examples: more smoothing in love example :) --- examples/love.alv | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'examples') 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) ))) -- cgit v1.2.3