Skip to content

Commit 292eefe

Browse files
Rollup merge of #96704 - GuillaumeGomez:rotation-animation, r=jsha
Add rotation animation on settings button when loading As discussed, I added an animation when the settings JS file is loading (I voluntarily made the timeout at the end of the `settings.js` super long so we can see what the animation looks like): https://user-images.githubusercontent.com/3050060/166693243-816a08b7-5e39-4142-acd3-686ad9950d8e.mp4 r? ````@jsha````
2 parents ef949da + 13b45aa commit 292eefe

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/librustdoc/html/static/css/rustdoc.css

+12
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,18 @@ pre.rust {
14011401
cursor: pointer;
14021402
}
14031403

1404+
@keyframes rotating {
1405+
from {
1406+
transform: rotate(0deg);
1407+
}
1408+
to {
1409+
transform: rotate(360deg);
1410+
}
1411+
}
1412+
#settings-menu.rotate img {
1413+
animation: rotating 2s linear infinite;
1414+
}
1415+
14041416
#help-button {
14051417
font-family: "Fira Sans", Arial, sans-serif;
14061418
text-align: center;

src/librustdoc/html/static/js/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ function loadCss(cssFileName) {
301301
}
302302

303303
getSettingsButton().onclick = event => {
304+
addClass(getSettingsButton(), "rotate");
304305
event.preventDefault();
305306
loadScript(window.settingsJS);
306307
};

src/librustdoc/html/static/js/settings.js

+1
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,6 @@
274274
if (!isSettingsPage) {
275275
switchDisplayedElement(settingsMenu);
276276
}
277+
removeClass(getSettingsButton(), "rotate");
277278
}, 0);
278279
})();

0 commit comments

Comments
 (0)