Observable Magic Gradient
How do I make an observable magic gradient?
This updates an older pen so as to play with RxCSS: mapping streams of user input to CSS Custom Props. What is a observable magic gradient? How do you make a observable magic gradient? This script and codes were developed by Oliver Turner on 28 November 2022, Monday.
Observable Magic Gradient - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Observable Magic Gradient</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <p>I whip my mouse back and forth</p> <script src='https://unpkg.com/rxcss@latest/dist/rxcss.min.js'></script>
<script src='https://unpkg.com/@reactivex/rxjs/dist/global/Rx.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Observable Magic Gradient - Script Codes CSS Codes
:root { --font-title: 18px; --grad-xStart: 280; --grad-xEnd: 40; --grad-start: hsl(var(--grad-xStart), 100%, 75%); --grad-end: hsl(var(--grad-xEnd), 100%, 50%);
}
body { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; height: 100vh; padding: 20px; background: -webkit-linear-gradient(315deg, var(--grad-start), var(--grad-end)); background: linear-gradient(135deg, var(--grad-start), var(--grad-end))
}
p { counter-reset: hueStart var(--grad-xStart) hueEnd var(--grad-xEnd); position: relative; padding: 5px 10px; border: 1px solid currentColor; border-radius: var(--font-title); font: 100 var(--font-title)/1 sans-serif; text-align: center; text-transform: uppercase; letter-spacing: 3px; color: #fff;
}
p::before, p::after { position: absolute; display: block; width: 100%; padding: 5px; font-size: 12px; color: #fff;
}
p::before { content: 'hsl(' counter(hueStart) ', 100%, 75%)'; bottom: 100%;
}
p::after { content: 'hsl(' counter(hueEnd) ', 100%, 50%)'; top: 100%;
}
Observable Magic Gradient - Script Codes JS Codes
'use strict';
var w = window.innerWidth;
var getPercentX = function getPercentX(x) { return Math.round(x / w * 360);
};
var mouse$ = Rx.Observable.fromEvent(document, 'mousemove').map(function (_ref) { var clientX = _ref.clientX; var percentX = getPercentX(clientX); return { xStart: percentX, xEnd: percentX + 120 };
});
RxCSS({ grad: mouse$ });
Developer | Oliver Turner |
Username | codedsignal |
Uploaded | November 28, 2022 |
Rating | 4.5 |
Size | 3,409 Kb |
Views | 12,144 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Frosted glass background | 2,963 Kb |
Single-element 3d speech bubble | 3,103 Kb |
Responsive progress reloaded | 5,417 Kb |
Remcon navigation | 3,261 Kb |
ColorLovers Reloadable | 2,279 Kb |
Coded Signal Logo | 3,807 Kb |
Isometric projection using skew | 2,959 Kb |
Single element title decoration | 2,087 Kb |
Magic Gradient | 3,588 Kb |
Cagey Avatar | 3,004 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS Patterns | Alyda | 3,953 Kb |
Click Based Rotation Demo | Zeaklous | 2,086 Kb |
NgEasyModal | Lorenzodianni | 4,159 Kb |
Vue.js Lazy Loading | Kjbrum | 3,620 Kb |
Angular Route | Arun_v606 | 1,837 Kb |
Right Click Menu | Anodpixels | 2,252 Kb |
A Pen by Ash | Littleginger | 2,386 Kb |
Cloud upload | Jaflo | 2,774 Kb |
Box Shadow Effects | Retrofuturistic | 2,143 Kb |
A Pen by Markku Lehmonen | SharpDal | 7,804 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!