can anybody help me on how to do this gradient animation? Figma link below
8 Replies
If you can't find a library to do it, you'd have to layer several gradient backgrounds from a color to transparent, then animate offsets on them
the blue is moving like I expect it to but the pink feels alternating
I think you need to make multiple backgrounds and layer them, you can just comma-seperate background layers in the background property, just make sure there's transparent elements to them
can you give me an example ?
so you can layer backgrounds like this in a single element:
but in this case, I think you may have to layer them in separate elements so they can have offset animations, or see if you can animate the gradients themselves. I'm not sure if you can do the latter
If you define them as coma separated background gradients as Jochem has demonstrated, you can then define a different background position for each one within your keyframes animation, something like this:
If you don't mind using registed custom properties, you can move them around in other ways too 😄 - https://codepen.io/kevinpowell/pen/pvJJpRY/27ae06d02a8bae81a5a5ce6bad2d8871?editors=1100
support is getting up there now for
@property
too 🙂