WEBLEB
होम
संपादक
लॉग इन करें
Pro
हिंदी
English
Français
Español
Português
Deutsch
Italiano
हिंदी
फोटो संपादक यूआई
1018
Andev.web
संपादक में खोलें
अपना कोड प्रकाशित करें
अनुशंसित
25 August 2024
यूआई एनीमेशन उत्पादों की खोज
29 August 2024
कैलकुलेटर यूआई - न्यूमॉर्फिज्म - सफेद
13 November 2024
छवियों के लिए 3D CSS फोटो फ्रेम प्रभाव
HTML
Copy
Andev Web
=
Contrast
Saturation
Brightness
Blur
Hue
CSS
Copy
:root { --contrast: 1; --saturate: 0; --blur: 0; --hue: 0deg; --brightness: 1; --img-size: 500px; --controls-width: 480px; --top-offset: -60px; --img-from-top: calc(50vh + (var(--img-size) / 2) + var(--top-offset)); --scroll-height: 60px; --ui-bg: #222; --ui-bg-transparent: #22222200; --buttons-row-height: 100px; } body { background-color: var(--ui-bg); font-family: sans-serif; } *::-webkit-scrollbar { display: none; } * { user-select: none; } body:has(input[name="mode"][value="contrast"]:checked) { .scroller[data-level="1"] { pointer-events: all; } .scroller[data-level="1"] .sizer[data-level="1"]::before { opacity: 1; } [data-mode="contrast"] { color: white; } } body:has(input[name="mode"][value="saturation"]:checked) { .scroller[data-level="2"] { pointer-events: all; } .scroller[data-level="2"] .sizer[data-level="2"]::before { opacity: 1; } [data-mode="saturation"] { color: white; } } body:has(input[name="mode"][value="brightness"]:checked) { .scroller[data-level="3"] { pointer-events: all; } .scroller[data-level="3"] .sizer[data-level="3"]::before { opacity: 1; } [data-mode="brightness"] { color: white; } } body:has(input[name="mode"][value="blur"]:checked) { .scroller[data-level="4"] { pointer-events: all; } .scroller[data-level="4"] .sizer[data-level="4"]::before { opacity: 1; } [data-mode="blur"] { color: white; } } body:has(input[name="mode"][value="hue"]:checked) { .scroller[data-level="5"] { pointer-events: all; } .scroller[data-level="5"] .sizer[data-level="5"]::before { opacity: 1; } [data-mode="hue"] { color: white; } } .scroller { height: var(--scroll-height); width: var(--controls-width); overflow-x: scroll; scroll-timeline-axis: x; position: fixed; top: var(--img-from-top); left: 0; right: 0; margin: auto; pointer-events: none; overflow-y: visible; } .scroller-cover { position: absolute; top: calc(var(--img-from-top)); pointer-events: none; height: var(--scroll-height); background-image: linear-gradient(to right, var(--ui-bg), var(--ui-bg-transparent) 30%, var(--ui-bg-transparent) 70%, var(--ui-bg)); z-index: 3; content: ''; left: 0; right: 0; margin: auto; width: var(--controls-width); } .scroller[data-level="1"] { scroll-timeline-name: --scroller-1; } .scroller[data-level="2"] { scroll-timeline-name: --scroller-2; } .scroller[data-level="3"] { scroll-timeline-name: --scroller-3; } .scroller[data-level="4"] { scroll-timeline-name: --scroller-4; } .scroller[data-level="5"] { scroll-timeline-name: --scroller-5; } .sizer { width: 200%; animation-duration: 1ms; animation-direction: alternate; animation-timing-function: linear; overflow: visible; } .scroll-center { content: ''; position: fixed; top: calc(var(--img-from-top) + var(--scroll-height) - 30px); height: 30px; width: 2px; background-color: #FF5D5D; left: -1px; right: 0; margin: auto; display: block; position: absolute; z-index: 9; pointer-events: none; } .sizer::before { content: ''; position: absolute; left: 50%; margin: auto; opacity: 0; background-image: url("https://assets.codepen.io/215059/ticker-6_6.svg"); background-size: 100% 16px; background-repeat: no-repeat; background-position: 0 100%; height: 20px; width: 100%; bottom: 0; pointer-events: none; } .sizer[data-level="1"] { animation-name: contrastAnimation; animation-timeline: --scroller-1; } .sizer[data-level="2"] { animation-name: saturateAnimation; animation-timeline: --scroller-2; } .sizer[data-level="3"] { animation-name: brightnessAnimation; animation-timeline: --scroller-3; } .sizer[data-level="4"] { animation-name: blurAnimation; animation-timeline: --scroller-4; } .sizer[data-level="5"] { animation-name: hueAnimation; animation-timeline: --scroller-5; } #image { width: var(--img-size); height: var(--img-size); position: fixed; pointer-events: none; top: calc(var(--img-from-top) - var(--img-size)); left: 0; right: 0; margin: auto; display: flex; background: var(--ui-bg); align-items: center; justify-content: center; } #image > div { object-fit: contain; width: 100%; height: 100%; margin: auto; overflow: hidden; text-align: center; } #image img { max-width: 100%; max-height: 100%; margin: auto; filter: contrast(var(--contrast)) saturate(var(--saturate)) brightness(var(--brightness)) blur(var(--blur)) hue-rotate(var(--hue)); } .buttons { position: fixed; left: 0; right: 0; margin: auto; top: calc(var(--img-from-top) + var(--scroll-height)); height: var(--buttons-row-height); width: var(--controls-width); z-index: 2; display: flex; justify-content: center; } .buttons > div { flex-basis: 90px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #949494; padding-top: 12px; position: relative; flex-direction: column; } .buttons > div input { appearance: none; opacity: 1; position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: block; width: 100%; height: 100%; z-index: 1; } .buttons > div .icon { width: 48px; height: 48px; background-color: #3B3B3B; border-radius: 50%; margin-bottom: 12px; display: inline-flex; align-items: center; justify-content: center; } .icon svg { width: 24px; } @keyframes contrastAnimation { 0% { --contrast: 0.3; } 50% { --contrast: 1; } 100% { --contrast: 2; } } @keyframes saturateAnimation { 0% { --saturate: 0; } 50% { --saturate: 1; } 100% { --saturate: 10; } } @keyframes blurAnimation { 0% { --blur: 0px; } 100% { --blur: 30px; } } @keyframes hueAnimation { 0% { --hue: 0deg; } 100% { --hue: 360deg; } } @keyframes brightnessAnimation { 0% { --brightness: 0; } 50% { --brightness: 1; } 100% { --brightness: 2; } }
JS
Copy
['--contrast', '--saturate', '--brightness'].forEach((property) => { CSS.registerProperty({ name: property, syntax: "<number>", initialValue: 0, inherits: "false" }); }) CSS.registerProperty({ name: '--blur', syntax: "<length>", initialValue: '0px', inherits: "false" }); CSS.registerProperty({ name: '--hue', syntax: "<angle>", initialValue: '0deg', inherits: "false" }); document.querySelectorAll('.scroller:not([data-no-initial-scroll])').forEach((s) => s.scrollLeft = s.scrollWidth / 4); document.querySelectorAll('.scroller').forEach((slider) => { let mouseDown = false; let startX, scrollLeft; const startDragging = (e) => { mouseDown = true; startX = e.pageX - slider.offsetLeft; scrollLeft = slider.scrollLeft; } const stopDragging = (e) => { mouseDown = false; } const move = (e) => { e.preventDefault(); if(!mouseDown) { return; } const x = e.pageX - slider.offsetLeft; const scroll = x - startX; slider.scrollLeft = scrollLeft - scroll; } slider.addEventListener('mousemove', move, false); slider.addEventListener('mousedown', startDragging, false); slider.addEventListener('mouseup', stopDragging, false); slider.addEventListener('mouseleave', stopDragging, false); })