Вращение текста при скролле
Все привет! Есть такой код ----> https://codepen.io/am-77/pen/xxGaoqd
Можно его переделать что бы он работал также, только вращался всегда вперед (при скролле в низ/вверх) Спасибо! |
вращение текста по часовой
ethereal,
<!DOCTYPE html> <html> <head> <title>Untitled</title> <meta charset="utf-8"> <style type="text/css"> :root{ --main-color: #F1F2F3; --second-color: #333333 } *{ margin: 0; padding: 0; box-sizing: border-box } .container{ display: block; width: 100%; height: 2850px; background: var(--main-color); position: relative; } .circular-text{ display: flex; flex-direction: column; align-items: center; justify-content: center; width: 200px; height: 200px; position: fixed; top: calc(100vh - 200px); right: 0; } .text{ font-family: "Fira Code"; font-weight: 700; font-size: 17px; text-transform: uppercase; color: var(--second-color); } .arrow{ display: block; width: 50px; height: 50px; position: absolute; } .arrow svg{ display: block; width: 100%; height: 100%; fill: var(--second-color); } </style> <script src="https://cdn.jsdelivr.net/npm/circletype@2.3.0/dist/circletype.min.js"></script> <script> document.addEventListener( "DOMContentLoaded" , function() { const text = document.querySelector(".circular-text .text") const rotate = new CircleType(text).radius(65) let angle = up = window.scrollY; window.addEventListener("scroll", function(){ angle += Math.abs(window.scrollY - up) text.style.transform=`rotate(${angle * 0.15}deg)`; up = scrollY; }) }); </script> </head> <body> <div class="container"> <div class="circular-text"> <p class="text">One • Two • Three • Viva • L'Algerie •</p> <div class="arrow"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 512.568 512.568" style="enable-background:new 0 0 512.568 512.568;" xml:space="preserve" width="512" height="512"> <path d="M184.284,235.284h140v40h-140V235.284z M275.284,436V315.284h-40V436l-53.858-53.858l-28.284,28.285l102.142,102.142 l105.142-105.142l-28.284-28.285L275.284,436z M235.284,76.568v118.716h40V76.568l56.858,56.858l28.284-28.284L255.284,0 L152.142,103.142l28.284,28.284L235.284,76.568z"/> </svg> </div> </div> </div> </body> </html> |
Часовой пояс GMT +3, время: 08:52. |