REBOL [ title: "AGG Particles demo" author: cyphre@seznam.cz note: "Based on McSeem's visualisation" Version: 1.0.0 Needs: [view 1.3.1] ] screen-size: 600x500 particles-count: 100 particles: make list! [] rot: 0 insert-event-func func [face evt][ if evt/type = 'resize [ bx/size: screen-size: evt/face/size ] evt ] view/new/options layout [ origin 0 bx: box black screen-size effect [draw []] at 10x10 txt: text white join "number of particles: " particles-count scroller 200x16 with [data: .5][ particles-count: to-integer face/data * 200 txt/text: join "number of particles: " particles-count show txt ] ][resize] while [not empty? system/view/screen-face/pane] [ particles: head particles loop 10 [ if particles-count > length? particles [ rot: (rot + 2) // 360 center: screen-size / 2 insert/only tail particles reduce [ color: random 255.255.255.0 color + 0.0.0.255 (center/x + (center/x / 3 * sine rot)) (center/y + (center/y / 3 * cosine rot)) (random 25) + 10 (random 200) / 10 - 10 (random 200) / 10 - 10 ] ] ] clear fx: bx/effect/draw insert fx [pen none] while [not tail? particles] [ p: particles/1 p/3: p/3 + p/6 p/4: p/4 + p/7 pos: as-pair p/3 p/4 either not within? pos 0x0 - p/5 screen-size + p/5 [ particles: back remove particles ][ insert tail fx compose [ fill-pen radial (pos) 0 (p/5) 0 1 1 (p/2) (p/2) (p/1 * 2) (p/2 - 0.0.0.128) (p/2 - 0.0.0.64) (p/2) circle (pos) (p/5) ] ] particles: next particles ] show bx wait .001 ] quit