I have seen a website and started thinking how to create a illustration of paper rocket moving in cubic beizer as in https://www.atlassian.com/
website. Help me do it with CSS on scroll. I tried the following code but failed.
$(function() {
var rotation = 0,
scrollLoc = $(document).scrollTop();
$(window).scroll(function() {
var newLoc = $(document).scrollTop();
var diff = scrollLoc - newLoc;
rotation += diff, scrollLoc = newLoc;
var rotationStr = "rotate(" + rotation + "deg)";
$(".plane").css({
"-webkit-transform": rotationStr,
"-moz-transform": rotationStr,
"transform": rotationStr
});
});
})
body {
overflow-x: hidden;
}
.container {
width: 100%;
height: 1000px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container" id="container">
<img class="plane" src="https://wac-cdn.atlassian.com/dam/jcr:db49283c-bf71-4ec4-b14c-fbc36a121b2f/plane-2.png?cdnVersion=ll" alt="" data-0="transform: translate3d(0px, 0px, 0)" data-1600="transform: translate3d(1600px, 200px, 0)" class="skrollable skrollable-between" style="transform: translate3d(228px, 28.5px, 0px);" width="168" height="36">
</div>