liquid-class
Version:
A modern JavaScript library for creating stunning liquid class effects with customizable displacement maps
399 lines (348 loc) • 7.05 kB
CSS
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
min-height: 100vh;
height: 100vh;
box-sizing: border-box;
background-color: #242424;
overflow: hidden;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
text-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
margin: 0px;
}
h3 {
margin: 0px;
}
p:first-child {
padding: 10px;
font-weight: bold;
background-color: #0000007f;
backdrop-filter: blur(5px);
border-radius: 10px;
}
#app {
width: 100%;
height: 100%;
position: relative;
box-sizing: border-box;
background: rgba(255, 255, 255, 0.1) url("https://4kwallpapers.com/images/wallpapers/macos-big-sur-apple-layers-fluidic-colorful-wwdc-stock-2880x1800-1455.jpg");
background-size: cover;
background-position: center;
background-blend-mode: overlay;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.5);
padding: 25px;
transform: translateZ(0);
-webkit-transform: translateZ(0);
will-change: transform;
}
@media (min-width: 1024px) {
#app {
flex: 1;
height: 100%;
}
}
@media screen and (max-width: 1023px) {
#app {
max-width: 95vw;
min-height: min-content;
height: auto;
padding: 15px;
transform: translateZ(0);
}
}
#app::after {
content: '';
position: absolute;
inset: 0;
z-index: 0;
overflow: hidden;
border-radius: inherit;
border: 2px solid rgba(255, 255, 255, 0.2);
}
#app-content {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
z-index: 2;
max-width: 100%;
box-sizing: border-box;
padding: 1rem;
}
@media (max-width: 1023px) {
#app-content {
min-height: 100%;
height: auto;
padding: 2rem 1rem;
flex-direction: column;
}
.demo-container {
margin-top: 2rem;
display: flex;
gap: 2rem;
flex-direction: column;
}
}
#video-player {
width: 100%;
height: 100%;
object-fit: cover;
z-index: 1;
position: absolute;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
.main-container {
display: flex;
flex-direction: column;
gap: 2rem;
width: 100%;
height: 100%;
margin: 0;
padding: 1rem;
box-sizing: border-box;
overflow: auto;
}
@media (min-width: 1024px) {
.main-container {
flex-direction: row;
align-items: stretch;
gap: 2rem;
height: 100%;
}
.sidebar {
width: 25vw;
min-width: 300px;
max-width: 400px;
height: 100%;
}
}
.sidebar {
display: flex;
flex-direction: column;
gap: 2rem;
}
#controls, #settings {
display: flex;
gap: 2rem;
padding: 2rem;
border-radius: 8px;
border: 1.5px solid rgba(255, 255, 255, 0.2);
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
width: 100%;
box-sizing: border-box;
}
#settings {
height: calc(100% - 200px);
overflow-y: auto;
flex: 1;
}
@media (max-width: 1023px) {
#settings, #controls {
padding: 1rem;
align-items: center;
}
#settings {
height: auto;
min-height: min-content;
overflow-y: visible;
justify-content: center;
}
.settings-list {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
justify-content: center;
}
.setting-item {
padding: 0.5rem;
font-size: 0.8rem;
}
}
/* Styling the scrollbar for settings */
#settings::-webkit-scrollbar {
width: 8px;
}
#settings::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.05);
border-radius: 4px;
}
#settings::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.2);
border-radius: 4px;
}
#settings::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.3);
}
#controls .control-group {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
align-items: start;
}
#controls .control-section {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
border-radius: 6px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
}
#controls .control-section-title {
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: rgba(255, 255, 255, 0.6);
margin-bottom: 0.5rem;
}
#controls label {
display: flex;
flex-direction: column;
gap: 0.5rem;
font-size: 0.9rem;
}
#controls label span {
font-size: 0.8rem;
color: rgba(255, 255, 255, 0.8);
}
#controls input[type="range"] {
width: 100%;
height: 6px;
-webkit-appearance: none;
appearance: none;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
outline: none;
}
#controls input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 16px;
height: 16px;
border-radius: 50%;
background: #fff;
cursor: pointer;
border: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
#controls input[type="color"] {
width: 100%;
height: 30px;
padding: 0;
border: none;
border-radius: 4px;
cursor: pointer;
background: transparent;
}
.settings-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 1rem;
width: 100%;
padding-bottom: 25px;
}
.setting-item {
padding: 0.75rem;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 6px;
font-size: 0.9rem;
color: rgba(255, 255, 255, 0.8);
}#controls select {
width: 100%;
padding: 0.5rem;
border-radius: 4px;
border: 1px solid rgba(255, 255, 255, 0.2);
background: rgba(0, 0, 0, 0.2);
color: white;
cursor: pointer;
outline: none;
}
#controls select:focus {
border-color: rgba(255, 255, 255, 0.4);
}
.wrapper {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
gap: 1rem;
}
@media (min-width: 1024px) {
.wrapper {
flex-direction: column;
flex-wrap: wrap;
gap: 2rem;
}
}
.card {
padding: 2rem;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.demo-container {
margin-top: 2rem;
display: flex;
gap: 2rem;
}
.demo-card {
width: 200px;
height: 150px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
flex-shrink: 0;
}
.icon {
width: 100px;
height: 100px;
border-radius: 50%;
object-fit: cover;
}