-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to apply blur radius? #31
Comments
Hi! I am really glad that you liked it! All the nights I've spent tinkering and working on it makes sense when I receive those compliments about it :) First of all, note that in your second image it doesn't have a CSS shadow works differently. I don't know the algorithms behind its graphics. There is no blur parameter in this lib, directly. Your css example: Changing to You can notice that the color gradient starts to fade before the component size. That doesn't happen by default in this lib; the gradient only start after the component size. The Here it's the 50 offset (px in web), black color and But, it's possible to mimic this behavior with a little hack like this one I came up with: (Source, built on top of your snack code: https://snack.expo.dev/@srbrahma/ada28a) Basically, the shadow is wrapping an inner smaller component with absolute positioning. You can fine tune the consts to have a more similar result to the css. But still, we can't make them look exactly the same, as with just SVG gradient of two color points it doesn't seem to be possible to reach that fancy css color decay. Maybe we should support this hack by default? Like a distanceOffset prop or something like that, to start the shadow transition before or after the component. I ain't sure now if it would work in all cases. Maybe we should add a prop to create custom gradient intervals instead of the current linear transition? I tried to achieve a similar look without this hack but it doesn't seem to be possible, but maybe you can have a better luck. Try changing the initialColor to a greyer one, different distance... Also, I discovered an interesting situation: If we change the startColor to It isn't an optical illusion, it's darker between the start and finalColors. It's due to how SVG gradient is changing from Maybe we should default the finalColor to transparent startColor? Back in the hack example, you can have different (and maybe better) results by changing the finalColor to What do you think? What should we do about it? |
I've added the improved default finalColor in 6.0.0 via d32dc12. The |
Hey, I just started to use your lib, and I think it's really important to have the possibility to set distance offsets. Great work btw ! 👍 |
@FrSenpai Thanks for the feeback! :) I will wait for further opinions.
|
+1 @SrBrahma on distance offset <3 <3 <3 |
Hi, sorry to say after so long but I no longer have plans on adding this by myself. PRs are welcome! |
Hello there.
First of all I want to thank you for this amazing library.
It's been good so far, but my shadow looks too hard.
How can I blur it? Like in css drop-shadow we have the blur property?
I want to make a shadow like this:
box-shadow: 0px 4px 15px #072A4233;
Here are the options that I passed in:
How much distance should I use? And where do I put the blur radius?
Here's the shadow in CSS:
![image](https://user-images.githubusercontent.com/57611063/144376785-fbd7a0e4-4438-47df-b963-ccf3765d900c.png)
https://codesandbox.io/s/priceless-wind-pvtwx?file=/src/styles.css
Here's what I did in React Native using your library:
![image](https://user-images.githubusercontent.com/57611063/144376896-bd997709-ac41-426a-b17d-a29f038f2510.png)
https://snack.expo.dev/@buitrbao222/react-native-button-box-shadow
The results are very different.
Thanks so much for your help.
The text was updated successfully, but these errors were encountered: