diff examples/misc/scope.scm @ 1:5df24c91468d

Oh my what a mess.
author samer
date Fri, 05 Apr 2019 16:26:00 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/misc/scope.scm	Fri Apr 05 16:26:00 2019 +0100
@@ -0,0 +1,40 @@
+(load "props.scm")
+
+(import "samer.core.types.*")
+
+(push-properties "scope.props")
+(put "canvas.background" Color.black$)
+(put "canvas.foreground" (Color. 60 220 120))
+(put "trace.background" Color.black$)
+
+(define C (node "canvas" (Plotter.)))
+(expose C "canvas")
+(.exposeMaps C)
+
+(define (oscillator nm freq)
+	(define o (Oscillator. freq))
+	(VParameter. nm (.getFrequencyModel o))
+;	(Product. (Constant. 256.0) o)
+	o
+)
+
+(tasks)
+
+(define x (VDouble. "x"))
+(define y (VDouble. "y"))
+
+(addtasks
+	(GenerateDouble. x (oscillator "fx" 0.1))
+	(GenerateDouble. y (oscillator "fy" 0.1))
+	(SilkTask.
+		(let ((P (.getPen C)))
+			(.moveto P 0 0)
+			(lambda ()
+				(.activate P)
+				(.line (.abs P (.value$ x) (.value$ y)))
+				(.move P)
+			)
+		))
+)
+
+(expose)