Website Animations
Context: I want to set up a structured way of playing different CSS animations invovling a series of keyframe sets and different HTML elements using Javascript.
Stacking Different CSS Animations on a Single Element
First, I wanted to have overlapping keyframe sets on my home page icon picture as an ‘on hover’ effect. When idle, the image will have a subtle floating effect.
The Issue: CSS only allows objects to have only one ‘transform’ property, or one ‘animation’ property.
In the example above, only the side-step
animation will play since it’s the last defined animation value set, and the transform styles in the keyframes will overwrite the styles from the transform: translateX(-10px);
statement.
In order to circumvent this issue, we can just layer and wrap the .animation-div
class with extra div’s where each div will play a specific animation.
This really isn’t anything revolutionary, but I thought it was neat enough to include it here lmao
Playing Animations with Sounds
Uh, I’m planning to implement some other things, but I’m preoccupied with some other stuff for now so I’m gonna leave the front page alone with the instant transmission thing xd
So uh here’s the basic javascript for what I have for now: