moving-shadow
Version:
A JavaScript module, which creates a responsive text shadow based on mouse position (desktop) or device orientation (mobile)
65 lines (57 loc) • 1.18 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- <script src="../movingShadow.js"></script> -->
<script src="https://unpkg.com/moving-shadow"></script>
<title>Shadow Example | Moving Shadow</title>
</head>
<body>
<div class="container">
<h2>Life isn't fair, it's just fairer than death, that's all.</h2>
<p>- William Goldman, <br>The Princess Bride</p>
</div>
</body>
</html>
<style>
html, body {
margin: 0;
overflow-x: hidden;
overflow-y: hidden;
height: 100vh;
}
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
background-color: #ff6c55;
color: #555;
font-family: helvetica;
font-size: 3rem;
}
@media (max-width: 600px) {
.container {
font-size: 2rem;
}
}
h2, p {
margin: 30px auto;
text-align: center;
max-width: 80%;
}
p {
font-size: 22px;
text-align: right;
/* color: #fff; */
}
</style>
<script>
const settings = {
color: "#ffc155", // shadow-color
}
movingShadow(settings);
</script>