We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › dynamic alpha masking (mouse controlled)
Page Index Toggle Pages: 1
dynamic alpha masking (mouse controlled) (Read 549 times)
dynamic alpha masking (mouse controlled)
Dec 7th, 2007, 4:19pm
 
hello,

at http://basislager.org/dynamic_alpha_mask/v1.html you find a first experiment i've done in processing (source-code attached to the website). in this example i'd like to have an effect like wiping off snow from a window. until now i've (kind of) managed to get working with a square - moving the mouse of the applet while having the left key of the mouse pressed reveales the background image by continiously setting the pixels of the dynamically generated alphamask to 255 (the script is in a very preliminary state ...

i'd like to do this in a more 'naturally' looking way - not square fields being reveiled but unregular forms. but before i get into this (probably) tricky part of programming i'd like to know if there wouldn't be an easier way of doing this - e.g. applying another image (like a big unregular snowflake) that passes its alpha-information to the alphamask, continiously extending transparency will dragging the mouse? (hope you understood what i mean ...).

thanks a lot in advance for help,

stefan
Re: dynamic alpha masking (mouse controlled)
Reply #1 - Dec 11th, 2007, 11:55pm
 
it's cost me some time, but i've figured out this solution: http://basislager.org/dynamic_alpha_mask/v2.html

still somewhat preliminary and much too slow ... maybe someone can give a hint how to do that more efficiantly ...

thanks, stefan
Re: dynamic alpha masking (mouse controlled)
Reply #2 - Dec 12th, 2007, 1:35am
 
I'm pretty sure that what is slowing you is that you're loading the bg.jpg every time draw() loops. Try loading it in setup().
Re: dynamic alpha masking (mouse controlled)
Reply #3 - Dec 12th, 2007, 3:39pm
 
thanks for this hint. i tried to put
Code:

bg = loadImage("bg.jpg");

into setup(). yet that prevents the mask from being updated when i move the mouse (mask stays at the position where i first clicked with the mouse).
Re: dynamic alpha masking (mouse controlled)
Reply #4 - Dec 12th, 2007, 3:52pm
 
btw.: why are the applets running significantly slower if embedded into a website?
Page Index Toggle Pages: 1