animate based on mouse position
this is the code for the purple diamonds:
> obviously this only works on desktop
<div class="diamond" id="d1"></div>
<div class="diamond" id="d2"></div>
<div class="diamond" id="d3"></div>
<script>
window.addEventListener('load', function() {
gleit.animate(document.getElementsByClassName('diamond'),
{ '0vw': { translateX: '10vw', rotate: '45deg' },
'100vw': { translateX: '-10vw' }})
.on(gleit.mouseMove.client.x);
gleit.animate(document.getElementsByClassName('diamond'),
{ '0vh': { translateY: '10vh' },
'100vh': { translateY: '-10vh' }})
.on(gleit.mouseMove.client.y);
});
</script>
<style>
.diamond {
position: fixed; width: 10vmax; height: 10vmax;
border: 5vmax solid #673ab7; z-index: -999; }
.diamond#d1 { left: 10vw; top: 5vh; }
.diamond#d2 { left: 20vw; bottom: 5vh; }
.diamond#d3 { right: 5vw; top: 40vh; }
</style>