summaryrefslogtreecommitdiff
path: root/starling/node-2d.scm
diff options
context:
space:
mode:
Diffstat (limited to 'starling/node-2d.scm')
-rw-r--r--starling/node-2d.scm35
1 files changed, 18 insertions, 17 deletions
diff --git a/starling/node-2d.scm b/starling/node-2d.scm
index 5ee75fe..d66615c 100644
--- a/starling/node-2d.scm
+++ b/starling/node-2d.scm
@@ -309,10 +309,8 @@
(define-method (move-to (node <node-2d>) x y)
- (let ((p (position node)))
- (set-vec2-x! p x)
- (set-vec2-y! p y)
- (dirty! node)))
+ (set! (position-x node) x)
+ (set! (position-y node) y))
(define-method (move-to (node <node-2d>) x y duration ease)
(let ((p (position node)))
@@ -360,8 +358,7 @@
(compute-matrices! node))
(define-method (rotate-to (node <node-2d>) theta)
- (set! (rotation node) theta)
- (dirty! node))
+ (set! (rotation node) theta))
(define-method (rotate-to (node <node-2d>) theta duration ease)
(tween duration (rotation node) theta
@@ -382,26 +379,27 @@
(rotate-by node dtheta duration smoothstep))
(define-method (scale-to (node <node-2d>) sx sy)
- (let ((s (scale node)))
- (set-vec2-x! s sx)
- (set-vec2-y! s sy)
- (dirty! node)))
+ (set! (scale-x node) sx)
+ (set! (scale-y node) sy))
+
+(define-method (scale-to (node <node-2d>) s)
+ (scale-to node s s))
(define-method (scale-to (node <node-2d>) sx sy duration ease)
- (let ((s (scale node)))
- (scale-by node (- sx (vec2-x s)) (- sy (vec2-y s)) duration ease)))
+ (scale-by node (- sx (scale-x node)) (- sy (scale-y node)) duration ease))
(define-method (scale-to (node <node-2d>) sx sy duration)
(scale-to node sx sy duration smoothstep))
(define-method (scale-by (node <node-2d>) dsx dsy)
- (let ((s (scale node)))
- (scale-to node (+ (vec2-x s) dsx) (+ (vec2-y s) dsy))))
+ (scale-to node (+ (scale-x node) dsx) (+ (scale-y node) dsy)))
+
+(define-method (scale-by (node <node-2d>) ds)
+ (scale-by node ds ds))
(define-method (scale-by (node <node-2d>) dsx dsy duration ease)
- (let* ((s (scale node))
- (start-x (vec2-x s))
- (start-y (vec2-y s)))
+ (let ((start-x (scale-x node))
+ (start-y (scale-y node)))
(tween duration 0.0 1.0
(lambda (n)
(scale-to node
@@ -412,6 +410,9 @@
(define-method (scale-by (node <node-2d>) dsx dsy duration)
(scale-by node dsx dsy duration smoothstep))
+(define-method (scale-by (node <node-2d>) ds duration (ease <procedure>))
+ (scale-by node ds ds duration ease))
+
(define-method (follow-bezier-path (node <node-2d>) path duration forward?)
(let ((p (position node))
(path (if forward? path (reverse path))))