By use of CSS Animation we can change or rotate most parts of a sentence.
Hello friends in this post you will see how to create typography effects. Here I am going to rotate some part from a sentence. We will exchange words to another words using CSS Animations.
Please Note: these results can be seen only those browers who supports CSS Animations.
So let’s start!
In the following, we’ll be going through demo 2.
Here we have a main wrapper with a title tag h2 heading which will contain leve frist spans and tow divs for the rotating words:
Now, ignoring the trash placeholder text, we throbbing each span of the rw-word to appear at a time. For that well be using CSS animations. Well make one animation for each divs will and each span will manage it, just considering exchange delays.
So, let’s look at the CSS.
First, we will style the main wrapper and middle it upon the page:
Well be credited gone some text shadow to all the elements in the heading:
And merger some specific text styling to the spans:
The divisions will be displayed as inline elements, that will allow for entry us to put in them into the sentence without breaking the flow:
Each span inside of a rw-words div will be positioned absolutely and well conceal any overflow:
Now, well control two animations. As mentioned forward, well control the same animation for all the spans in one div, just back alternating delays:
Our animations will control one cycle, meaning that each span will be shown also for three seconds, therefore the defer value. The whole animation will control 6 (number of images) * 3 (freshen grow pass) = 18 seconds.
We will exaggeration to set the right percentage for the opacity value (or all makes the span appear). Dividing 6 by 18 gives us 0.333 which would be 33% for our keyframe step. Everything that we hurting to happen to the span needs to happen past that. So, after tweaking and seeing what fits best, we come happening taking into account the when animation for the first words:
Well fade in the span and well furthermore lively its peak.
The openness for the words in the second div will fade in and animated their width. We supplementary a bit to the keyframe step percentages here, because we tormented sensation these words to appear just a little bit fused than the ones of the first word:
And thats it folks! There are many possibilities for the animations, you can check out the added demos and see what can be applied!
- Demo 1: Animate down
- Demo 2: Animate height and width
- Demo 3: Fade in and “fall”
- Demo 4: Animate width and fly in
- Demo 5: Rotate in 3D and “sharpen”
I hope you enjoyed this tutorial and find it inspiring!