CSS3 Transformation while scrolling

后端 未结 3 874
执笔经年
执笔经年 2021-02-04 21:57

Does anyone know of a good tutorial to achieve this? (as seen here: http://www.contrastrebellion.com/) I\'ve looked at the code used on that site and finding it awkward to pull

3条回答
  •  执念已碎
    2021-02-04 22:10

    You can of course use a simple way like Infra Stank's answer. However if you need a more complex thing to "animate" try jQuery Transe. It is a thorough solution for exactly this problem. You can change almost anything based on the current scroll offset (even CSS3-Transforms and suchlike).

    In your case, try something like this:

    $('img').transe({
        start: 0,
        end: 1600,
        css: 'transform',
        from: 'rotate(0deg)',
        to: 'rotate(360deg)'
    });
    

    Demo

    BTW: If you like smooth things, you can include TweenLite with its CSS-Plugin.

提交回复
热议问题