Sharpnado.Shadows icon indicating copy to clipboard operation
Sharpnado.Shadows copied to clipboard

A pressed effect with inverted-inner shadows

Open shawyunz opened this issue 5 years ago • 4 comments

Nice to have neumorphism on Xamarin. Have you considered to add a pressed effect with inverted-inner shadows? (Probably need SkiaSHarp then)

A Simple sample goes like this dribbble pic.

Btw, more "want" than "need" for this request. Thanks.

shawyunz avatar Jun 14 '20 21:06 shawyunz

I have the same need... +1

A full neuromorphism UI implementation will need to manage shadows "outside" (elevation positive) and shadows "inside" (elevation negative) for different views (Entry/Button/Frame...) exactly like @shawyunz shared image.

Is there a possibility/ehancement for doing it with your "Sharpnado.Shadow" implementation ? I tried to put negative offset, but it doesn't work (I didn't expected this to work, but I tried ;-) )

I'm dreaming of a single boolean bindable property (IsShadowInside) to achieve that like this :

<sh:Shadows Shades="{sh:NeumorphismShades}"
            IsShadowInside="{Binding IsPushed}">
        <Frame BackgroundColor="#F1F1F1"
               CornerRadius="10"
               HasShadow="False">
            <StackLayout>
                <Label Style="{StaticResource TextHeadline}" Text="Welcome to the HomePage !" />
                <Label Style="{StaticResource TextBody}" Text="Need to customize your page here..." />
            </StackLayout>
        </Frame>
</sh:Shadows>

I'll check your sourcecode to find if it can be a possible ehancement... feel free to guide me (or suggest me other ways)

Jerome-Liger avatar Jul 10 '20 12:07 Jerome-Liger

Inner Shadows are definitely something interesting and I will probably give it a try :) Right now your can already have some kind of push effect by swapping the colors of the 2 neumorphic shades on the Tap or click event in the code-behind.

Or I think you can even achieve it with VisualState by setting shades with NeumorphismShades in a "Idle" state and create a pair of shades like this (offset between white and dark shades are inverted) on a "Pressed" state:

        <sh:ImmutableShades>
                <sh:Shade BlurRadius="10"
                          Opacity="1"
                          Offset="10,10"
                          Color="White" />
                <sh:Shade BlurRadius="10"
                          Opacity="1"
                          Offset="-6, -6"
                          Color="#19000000" />
        </sh:ImmutableShades>

roubachof avatar Jul 11 '20 09:07 roubachof

On the topic of inverted shadows with neumorphism, I feel like they are sort of a bad idea in certain scenarios as they dont have much of a contrast to the unpressed look (also it just looks sort of weird to me). I was reading an article providing a better alternative which was using an outline that you could just darken and lighten to indicate pressed and unpressed states.

tatapuchi avatar Mar 18 '21 19:03 tatapuchi

We really need an inner shadow tool too.

mhrastegari avatar Jul 22 '21 11:07 mhrastegari