Skip to content

Instantly share code, notes, and snippets.

@trinhvanminh
Created May 21, 2024 03:38
Show Gist options
  • Save trinhvanminh/767cf2f582b98d173afdb7731b06e057 to your computer and use it in GitHub Desktop.
Save trinhvanminh/767cf2f582b98d173afdb7731b06e057 to your computer and use it in GitHub Desktop.
:root {
--text-gradient-stop-1: #4285f4;
--text-gradient-stop-2: #9b72cb;
--text-gradient-stop-3: #d96570;
--color-surface: #fff;
}
div {
background: linear-gradient(
74deg,
/* end here (2) */ var(--text-gradient-stop-1) 0,
var(--text-gradient-stop-2) 9%,
var(--text-gradient-stop-3) 20%,
var(--text-gradient-stop-3) 24%,
var(--text-gradient-stop-2) 35%,
var(--text-gradient-stop-1) 44%,
var(--text-gradient-stop-2) 50%,
var(--text-gradient-stop-3) 56%,
var(--color-surface) 75%,
/* start here (1) */ var(--color-surface) 100%
);
/* 400% is 4 times wider than the div width */
background-size: 400% 100%;
color: transparent;
background-position-x: 100%; /* start from the 100% (1) and then moving backwards to the 0% (2) */
transition: background-position-x 3s;
}
@trinhvanminh
Copy link
Author

trinhvanminh commented May 21, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment