16
NGUI 3 Support / Any alternatives to UIPanels for hard edge clipping?
« on: October 11, 2014, 04:20:08 AM »
I'm implementing a reusable UI based on Android interface guidelines. Many animated elements from the guidelines can easily be implemented using simple layered sprites. For example, here are standard switches using three simple NGUI sprites each:

With other elements, here is a tiny little problem, though. That problem is the extreme use of clipped effects on rectangular clickable elements. Check the following sample animations from the guidelines:
http://material-design.storage.googleapis.com/videos/components-tabs-spec-tabtouch-example_large_xhdpi.mp4
http://material-design.storage.googleapis.com/videos/components-menus-menus-textfield_dropdown_spec_large_xhdpi.mp4
https://material-design.storage.googleapis.com/videos/components-buttons-mainbuttons-buttons-motionraised_large_xhdpi.mp4
Every touch creates an ripple that must be clipped within the touched element. That's where things get tricky. You can imitate it pretty easily using UIPanel, of course:

Except you definitely do not want UIPanels within the hierarchy of every single button, tab, field and card, because you do not want to isolate parts of your widgets into an entirely separate part of depth hierarchy and because you do not want to clutter your panel list with those tiny clip areas. So, is there some lightweight alternative to UIPanel that can only do clipping (not even soft edge, extremely crude rectangular edge clipping, for example depth based, will suffice too - no need for texture-defined masking, no need for circular clipping, nothing like that) without all other rich functionality and hierarchy fragmentation UIPanels bring with them?

With other elements, here is a tiny little problem, though. That problem is the extreme use of clipped effects on rectangular clickable elements. Check the following sample animations from the guidelines:
http://material-design.storage.googleapis.com/videos/components-tabs-spec-tabtouch-example_large_xhdpi.mp4
http://material-design.storage.googleapis.com/videos/components-menus-menus-textfield_dropdown_spec_large_xhdpi.mp4
https://material-design.storage.googleapis.com/videos/components-buttons-mainbuttons-buttons-motionraised_large_xhdpi.mp4
Every touch creates an ripple that must be clipped within the touched element. That's where things get tricky. You can imitate it pretty easily using UIPanel, of course:

Except you definitely do not want UIPanels within the hierarchy of every single button, tab, field and card, because you do not want to isolate parts of your widgets into an entirely separate part of depth hierarchy and because you do not want to clutter your panel list with those tiny clip areas. So, is there some lightweight alternative to UIPanel that can only do clipping (not even soft edge, extremely crude rectangular edge clipping, for example depth based, will suffice too - no need for texture-defined masking, no need for circular clipping, nothing like that) without all other rich functionality and hierarchy fragmentation UIPanels bring with them?