summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-08-29 08:02:41 -0400
committerDavid Thompson <dthompson2@worcester.edu>2018-08-29 08:02:41 -0400
commit2f6ee30d41a773561cf41f48acdfa312ddbfae05 (patch)
tree7e985c8e0b867687332b2e03bd2d49c2f149a3ce
parent84ff75e4dad02f1362425d5208b4c57aa237eb39 (diff)
node: Add blink method.
* starling/node.scm (blink): New method.
-rw-r--r--starling/node.scm19
1 files changed, 18 insertions, 1 deletions
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 <node> ()
;; 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 <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)))