REBOL [ Title: "Mouse gestures, experiment" ] distance?: func [mov] [ mov/x * mov/x + (mov/y * mov/y) ] between?: func [val start end] [ all [val >= start val < end] ] upd-cmd: func [[throw] cond command alt x /local cur] [ if cond [ cur: pick tail command -1 ; last (this way falls back to none) x: pick next alt sign? x if x <> cur [append command x] exit ; throws ] ] update-gesture: func [command traces /local mov a upd] [ traces: tail traces mov: traces/-1 - traces/-2 if 150 > distance? mov [exit] ; small movement, discard upd-cmd mov/y = 0 command [#"4" #"6"] mov/x upd: func [[throw] cond alt] [upd-cmd cond command alt mov/y] a: mov/x / mov/y upd a < -2 [#"6" #"4"] upd between? a -2 -0.5 [#"9" #"1"] upd between? a -0.5 0.5 [#"8" #"2"] upd between? a 0.5 2 [#"7" #"3"] upd a > 2 [#"4" #"6"] ] view center-face layout [ box 400x400 feel [ engage: func [f a e] [ switch a [ down [ f/rate: 5 insert tail f/effect/2 e/offset disp/text: clear "" show [disp f] ] up [ f/rate: none clear skip f/effect/2 5 show f ] time [ ; hmm, looks like e/offset is absolute on time events?? insert tail f/effect/2 e/offset - win-offset? f update-gesture disp/text f/effect/2 show [disp f] ] ] ] ] effect [draw [pen red line-width 3 line]] disp: info 400 ]