Fade in and rotate element

We are using this template in this article, download it or simply use your own

The hover interactions it not the same anymore!, this will take your animations to the next level!.

Section number seven which is title is Centered Title we have three images, we want to add elements to this image to appear on the top of the image (overlay), let’s start !.

First add a class to the link and call it .img-overlay-container and add a new div inside that link and let’s give it a class .img-overlay, inside img-overlay div add three icons <i class="fa fa-play"></i>, <i class="fa fa-heart"></i> and <i class="fa fa-reorder"></i>, also add h3 inside the same div¬†<h3>Hi There ! ;)</h3>

  1. <a href="#" class="thumbnail img-overlay-container">
  2. <div class="img-overlay">
  3. <i class="fa fa-play"></i>
  4. <i class="fa fa-heart"></i>
  5. <i class="fa fa-reorder"></i>
  6. <h3>Hi There ! ;)</h3>
  7. </div>
  8. <img src="images/project-1.jpg" alt="">
  9. </a>

Fade in and rotate element - Add Elements

Now let’s add some CSS rules

  1. .img-overlay-container
  2. {
  3. position: relative;
  4. display: inline-block;
  5. margin-bottom: 30px;
  6. }
  8. .img-overlay {
  9. width: 100%;
  10. height: 100%;
  11. display: block;
  12. background-color: rgba(225, 123, 123, 0.5);
  13. position: absolute;
  14. left: 0;
  15. top: 0;
  16. text-align: center;
  17. padding-top: 100px;
  18. overflow: hidden;
  19. }
  21. .img-overlay > .fa {
  22. color: white;
  23. font-size: 50px;
  24. padding-left: 20px;
  25. padding-right: 20px;
  26. cursor: pointer;
  27. }
  29. .img-overlay > h3 {
  30. color: white;
  31. font-weight: bold;
  32. position: absolute;
  33. width: 100%;
  34. padding-top: 25px;
  35. padding-bottom: 25px;
  36. bottom: -20px;
  37. background-color: rgba(225, 123, 123, 0.6);
  38. }

Image Overlay - Add CSS

Now let’s add animation settings, select the link and go to the ACT¬†panel and click on Animation 1, change the trigger to Hover and the target to > .img-overlay, the grater than sign (>) means that I want to effect an element inside this element (in our case inside the link) and it doesn’t have to be a direct child, under the ANIMATION STEPS section let’s change the Init state to opacity:0;, Step 1 to opacity:1; and under the HOVER OUT section change the Step 1 to opacity:0;

We want to rotate and scale up the icons when the user hover it, so select the link again and click on Animation 2 to create a new animation, set the trigger to Hover, the target to > .fa, change the Init state to transform:rotate(20deg)scale(0.9); and Step 1 to transform:rotate(0)scale(1);, under the HOVER OUT section change the Step 1 to transform:rotate(20deg)scale(0.9);

Save it and test it !.

Finally, we want to animate the h3 to slide up, now you get it !

Trigger: Hover
Target: > h3
Init state: transform:translateY(30px);
Step 1: transform:translateY(0px);
Step 1: transform:translateY(30px);

Save it and test it again !

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.