JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <div id="cog"></div>
</body>

CSS

body {
    background: #ffc;
    height: 2000px;
    margin: 0;
}

#cog {
    background: #00f;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    position: fixed;
    top: 20px;
    left: 20px;
}

JavaScript

var $cog = $('#cog'),
    $body = $(document.body),
    bodyHeight = $body.height();

$(window).scroll(function () {
    $cog.css({
        'transform': 'rotate(' + ($body.scrollTop() / bodyHeight * 360) + 'deg)'
    });
});