processing: Move some items from the bubble-chamber demo

db4
Eduardo Cavazos 2008-04-08 02:26:02 -05:00
parent 9430478503
commit e67978b759
1 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,6 @@
USING: kernel namespaces threads combinators sequences arrays
math math.functions
math math.functions math.ranges random
opengl.gl opengl.glu vars multi-methods shuffle
ui
ui.gestures
@ -16,6 +16,18 @@ IN: processing
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: 2random ( a b -- num ) 2dup swap - 100 / <range> random ;
: 1random ( b -- num ) 0 swap 2random ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: chance ( fraction -- ? ) 0 1 2random > ;
: percent-chance ( percent -- ? ) 100 / chance ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: fill-color
VAR: stroke-color