big-swirler


Information

Created with NetLogo version NetLogo 4.0.4
Running with NetLogoLite.jar version 404.


WHAT IS IT?


-------
A madel that creates a transform field, then uses the field to swirl colors.

Procedures

NetLogo Version: NetLogo 4.0.4

globals
[ center
 oskip
 oangle
]

patches-own
[ source
  blend
  anti-blend
  new-color
  rr gg bb
  
]

to setup
   ca
   ask patches
   [ set pcolor random-float 140 ]
   set center patches at-points
   (list (list (  max-pxcor ) (  max-pycor ) ) (list min-pxcor min-pycor )
         (list min-pxcor (  max-pycor ) ) (list (  max-pxcor ) min-pycor )
         [ 0 0 ]       
    )
    set center [ neighbors ] of center 
    setup-swirl
   
end

to party
   every delay
   [ 
     if skip != oskip or angle != oangle
     [ setup-swirl 
       set oskip skip
       set oangle angle
     ]
     ask (patch-set center)
     [ let splash random-color
       ask patches in-radius (skip )
       [ set pcolor splash ]
     ]
    ; ask n-of 5 patches
    ; [ let splash-color random-color
    ;   ask patches in-radius skip
    ;   [ set pcolor splash-color ]
    ; ]
   
     move
   ]
end

to setup-swirl
   ask patches
   [ set source patch-at (skip * sin ( angle + towardsxy-nowrap .1 .1 )) (skip  * cos (angle + towardsxy-nowrap .1 .1 ))
     set blend .75
     set anti-blend 1.0 - blend
   ]
end

to move
   every delay
   [ ask patches
   [ ;; setrrggbb 
     ;; set new-color .5 * ( pcolor + pcolor-of source )
     set new-color [pcolor] of source - .1
     ;; setrrggbb
     ;; random-rgb
   ]
   ; ask patches
   ;[  set new-color blend-colors
   ;] 
   ask patches
   [ ;; set pcolor blend-colors 
      set pcolor new-color
   ]
  ]
end

to-report blend-colors
   report approximate-rgb
          ( rr * anti-blend + [rr] of source * blend)
          ( gg * anti-blend + [gg] of source * blend)
          ( bb * anti-blend + [bb] of source * blend)
end

to setrrggbb
   let rrggbb extract-rgb pcolor
   set rr item 0 rrggbb
   set gg item 1 rrggbb
   set bb item 2 rrggbb
end

to  random-rgb
    set rr random-float 1
    set gg random-float 1
    set bb random-float 1
end   
    

to-report random-color
  report 10 * random 13 + 3 + random-float 7
end
  

                    


Download Link

View or download the complete model file (to download: right-click, save-link-as):
-- Download big-swirler --