mirror of
https://github.com/alexfoxy/lax.js.git
synced 2026-01-13 16:28:06 -05:00
61 lines
1.3 KiB
HTML
61 lines
1.3 KiB
HTML
<head>
|
|
<script type="application/javascript" src="../lib/lax.min.js"></script>
|
|
<script type="application/javascript">
|
|
|
|
window.onload = function () {
|
|
lax.init()
|
|
|
|
lax.addDriver('scrollY', function () {
|
|
return window.scrollY
|
|
})
|
|
|
|
lax.addElements("#text", {}, {
|
|
onUpdate: function (driverValues, domElement) {
|
|
const scrollY = driverValues.scrollY[0]
|
|
|
|
const oCount = Math.floor((scrollY / 10) + 1)
|
|
const oString = Array.from({ length: oCount }, (v, i) => "o").join("")
|
|
domElement.innerHTML = "scr" + oString + "ll"
|
|
|
|
if (scrollY > 1000) {
|
|
domElement.classList.add('pink')
|
|
} else {
|
|
domElement.classList.remove('pink')
|
|
}
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<style>
|
|
#text {
|
|
width: calc(100vw - 40px);
|
|
left: 20;
|
|
top: 20;
|
|
position: fixed;
|
|
font-size: 60px;
|
|
font-family: sans-serif;
|
|
color: #a26ddc;
|
|
overflow-wrap: anywhere;
|
|
font-weight: bold;
|
|
}
|
|
|
|
#text.pink {
|
|
color: #ff568c;
|
|
}
|
|
|
|
body {
|
|
padding: 0;
|
|
background-color: #dedbde;
|
|
background-image: linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);
|
|
margin: 0;
|
|
background-size: 700px 700px;
|
|
height: 1000000px;
|
|
}
|
|
</style>
|
|
|
|
<body>
|
|
<div id="text">
|
|
</div>
|
|
</body> |