View Single Post
Old 05-26-2013, 01:30 PM   #50
bang
Human being with feelings
 
bang's Avatar
 
Join Date: Jul 2006
Posts: 626
Default

Quote:
Originally Posted by Justin View Post
If you changed local(a1,b1) to instance(a1,b1), I believe this might work! local namespace support would be nice, too, but it isn't currently supported.
yes. but won't we end up with <psuedo-object>.a1.r/g/b/a and <psuedo-object>.b1.r/g/b/a for every psuedo-object which uses rgbamix2()? i guess i haven't wanted to load up the Js namespace any more than i need to. it already gets to be a pretty massive variables list in the debug window. :^)

and fwiw... what i'd really love to see someday is a way to alias psuedo-object namespaces inside functions. something like:
Code:
// rgbamix2( mix, a, b )
function rgbamix2( mix, @a1, @b1 )
  instance( r, g, b, a )
(
  mix1= 1-mix;
  r= a1.r * mix1 + b1.r * mix; // r= a.r * mix1 + b.r * mix
  g= a1.g * mix1 + b1.g * mix;
  b= a1.b * mix1 + b1.b * mix;
  a= a1.a * mix1 + b1.a * mix;
);
just sayin'... :^)

enjoy! /dan

ps- also fwiw, stack_push()/pop() are awesomely useful generally. thanks so much for those.

Last edited by bang; 05-26-2013 at 01:35 PM. Reason: ps
bang is offline   Reply With Quote