The HSV Funbox

By sercan386 on Jan 21, 2009

type /zz to initiate the rainbow creation. warning, this fills tons of memory. it may take more than a minute to generate this wicked rainbow.

alias zz { 
  window -paxdk0 @funbox 
  unset %fail %cow 
  while %fail != 50 { 
    inc %fail .1
    unset %cow 
    while %cow != 50 { 
      inc %cow .1
      drawdot -r @funbox $hsv($calc(%fail * %cow ),1,150) 1 $calc(%cow *10) $calc(%fail *10)
    } 
  } 
}
;$hsv by DukeNukem
alias -l hsv {   
  var %h $$1,%s $$2,%v $$3,%hi $calc($int($calc(%h / 60)) % 6),%f $calc(%h / 60 - %hi),%p $calc(%v * (1 - %s)),%q $calc(%v * (1 - %f * %s)),%t $calc(%v * (1 - (1 - %f) * %s))  
  if (%hi = 0) { var %r %v,%g %t,%b %p } 
  if (%hi = 1) { var %r %q,%g %v,%b %p }  
  if (%hi = 2) { var %r %p,%g %v,%b %t } 
  if (%hi = 3) { var %r %p,%g %q,%b %v }  
  if (%hi = 4) { var %r %t,%g %p,%b %v } 
  if (%hi = 5) { var %r %v,%g %p,%b %q }
  var %r $int($calc(%r * 255)),%g $int($calc(%g * 255)),%b $int($calc(%b * 255)) 
  return $rgb(%r, %g ,%b)
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.