r/webdev • u/not_larrie • Jun 17 '24
Question Designer trying to help my developer figure out an effect.
Hey Developers! I'm a designer and I'm looking to make life as easy as possible on my developer trying to research how to implement the design I have. He's doing his own research as well, but I want to see if I can help find some insight.
The design in question involves a "bulging" effect on an image where it "bulges" and "contracts" from the center on hover.
The best example I can find of it is here:
Hovering over an image here causes a similar effect to what I want, but in this example, the bulging effect follows the mouse, whereas I just need it in the center, although this effect is also incredible and I want to know how it's done. I typically use Wappalyzer to at least figure out what technologies are used but in this case, it just says its a PWA without giving more details, so I got stuck there.
Another example I found is here:
Specifically, the loading animation has images sprouting from the center stacking on top of each other, and as they are each image grows in size, it has that similar "bulge". I at least can view the technologies here, but can't figure out much more than that with my little from-end knowledge.
Would love to know if you Gurus have any insight on this or resources you can point us in the direction of! 🙏
9
u/PsychoPflanze Jun 17 '24
Image transformations are a pain, but doable. Normally developers should know how to either do it or figure out where to find the resources to be able to do it.
19
u/Okay_I_Go_Now Jun 17 '24 edited Jun 17 '24
Probably just a webgl shader transition.
Your dev can either find one online that he can tweak to his needs, or if you have a specific design that you're not willing to budge on, he can contract it out or spend a decent chunk of time researching the applied maths for it.
Also, https://learnopengl.com is a nice free resource for getting started.
8
u/budd222 full-stack Jun 17 '24
If you really wanted to make life easier, you wouldn't add these effects to your image. How does this improve the user's experience on the site?
13
u/esiao Jun 17 '24
Since the effect you're after is about pixel manipulation you won't be able to do it with CSS animations. You likely will need to use WebGL or Canvas for this. With Canvas you're looking for Pixel Manipulation algorithms, with WebGL you'll have to use a shader. You might find examples on the Shadertoy website but will need to adapt it for WebGL which is no small feat. If you really want to make your Dev's life easier go for a scale animation.
4
u/DepressionFiesta Jun 17 '24
I suppose that something like this is what you are looking for? (Press "Zoom" in the tool panel on the right and hover the images). The code for that, is here.
3
u/SuperFLEB Jun 17 '24
Apparently people are talking about WebGL shaders, but you might also be able to do something like this with a CSS/SVG feDisplacementMap filter and a map image made realtime with a canvas.
2
u/HipHopHuman Jun 17 '24
Not sure if you knew this but a closer example of what you want is in your second example, after the loading sequence is done, you can scroll up and down with the mousewheel to cycle through the images. Scrolling down has the "bulge" effect, scrolling up has a "dip" effect.
One way I could think of achieving this is a 2D/3D cloth simulation and shaders, which means WebGL is necessary. Three.js is one such technology you're looking for that can achieve that.
1
u/[deleted] Jun 18 '24
Three.js should be able to achieve this
15
u/[deleted] Jun 17 '24
[removed] — view removed comment