What is the best strategy to creating subtle complex gradients like the attached. I tried to see what the css was in this element, but it may be set in the canvas javascript itself.
I am not sure if this is a linear gradient – or made up of multiple gradients stacked on top of each other with differing degrees of opacity.
Its as if there is a spot of indigo top/left and peach in the bottom/left
https://jsfiddle.net/Ls4dr3bo/1/
body{
background: rgb(229,232,236);
background: linear-gradient(90deg, rgba(229,232,236,1) 0%, rgba(229,232,236,1) 35%, rgba(231,217,219,1) 74%, rgba(231,221,224,1) 100%);
}
.container{
height: 100vh;
width:100%;
}
<div class="container">
</div>
possible html and css used in reference
jsx
'use client';
import gsap from 'gsap';
import { useLayoutEffect, useRef } from 'react';
import { Section } from '~/components/ui';
import { cx } from '~/utils';
import styles from './ExoIrisGradientTransition.module.scss';
export const ExoIrisGradientTransition = () => {
const containerRef = useRef(null);
useLayoutEffect(() => {
const ctx = gsap.context(() => {
if (!containerRef.current) return;
gsap.to('.js__solid', {
opacity: 1,
scrollTrigger: {
trigger: '.js__gradientContainer',
start: '80% bottom',
end: 'bottom bottom',
// markers: true,
scrub: true,
},
});
}, containerRef);
return () => {
ctx.revert();
};
}, []);
return (
<Section className={styles.container} ref={containerRef}>
<div className={cx(styles.gradientContainer, 'js__gradientContainer')}>
<div className={cx(styles.gradient, 'js__gradient')} aria-hidden />
<div className={cx(styles.solid, 'js__solid')} aria-hidden />
</div>
</Section>
);
};
css
.container {
position: relative;
display: flex;
background: transparent;
flex-flow: column nowrap;
z-index: 5;
}
.gradientContainer {
--container-height: 160vh;
height: var(--container-height);
position: relative;
width: 100%;
@include landscape {
--container-height: 200vh;
}
}
.gradient {
width: 100%;
height: var(--container-height);
background: linear-gradient(
180deg,
rgba(236, 194, 111, 0.5) 0%,
rgba(110, 153, 234, 1) 65%,
rgba(8, 11, 27, 1) 100%
);
@include landscape {
background: linear-gradient(
140deg,
rgba(255, 255, 255, 1) 0%,
rgba(236, 194, 111, 1) 33%,
rgba(110, 153, 234, 1) 66%,
rgba(8, 11, 27, 1) 100%
);
}
}
.solid {
position: absolute;
top: 0;
z-index: 2;
width: 100%;
height: var(--container-height);
background: $color-dark-dark-blue;
opacity: 0;
}
2
Answers
You can try with your colors in the background, it is built using simple CSS with
filter
andbackdrop-filter
, please edit this code in your own file because the width of the result on this page is small.It looks like 3 ellipses with some
filter
, butradial-gradient
look close enough. (Run the code snippet in full page mode for better result)