From 2f6ee30d41a773561cf41f48acdfa312ddbfae05 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 29 Aug 2018 08:02:41 -0400 Subject: node: Add blink method. * starling/node.scm (blink): New method. --- starling/node.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/starling/node.scm b/starling/node.scm index 51866d2..efb3c12 100644 --- a/starling/node.scm +++ b/starling/node.scm @@ -46,7 +46,8 @@ child-ref & attach-to - detach)) + detach + blink)) (define-class () ;; Symbolic name. Used for easy lookup of children within a parent. @@ -211,3 +212,19 @@ represented as a ratio in the range [0, 1]." (define-method (detach . nodes) "Detach all NODES from their respective parents." (for-each detach nodes)) + + +;;; +;;; Simple Script Actions +;;; + +(define-method (blink (node ) times interval) + (let ((orig (visible? node))) + (let loop ((i 0)) + (when (< i times) + (set! (visible? node) #f) + (sleep interval) + (set! (visible? node) #t) + (sleep interval) + (loop (+ i 1)))) + (set! (visible? node) orig))) -- cgit v1.2.3