[REBOL] [DRAW heartbeat] Anyone have a heartbeat/ECG style chart?
From: james::mustard::co::nz at: 18-Jul-2007 11:52
For your amusement ;)
rebol[]
random/seed now/time
beats: copy [4 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 4 0 0 0 0 0
0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
heartbeat: func [/local g n p beatpart][
g: copy []
p: copy []
beatpart: copy/part beats 24
repeat n length? beatpart [
append p compose [(as-pair n * 10 (beatpart/:n) * -10) (as-pair
(n * 10) + 5 (beatpart/:n) * 10)]
]
append g compose/deep [
translate 0x60
fill-pen off
line-width 5
pen 0.255.0.200
spline 20 (p)
line-width 1
pen 0.255.100
spline 20 (p)
]
append beats first beats
remove beats
return g
]
view layout/size [
at 10x10 box 260x120 black edge [size: 0x0] rate 0:00:0.1 effect
[draw[]] feel [
engage: func [f a e][
if a = 'time [f/effect/draw: heartbeat show f]
]
]
] 280x140
Gregg Irwin wrote: