animated-intro-section
October 29, 2015 | 1 Feedback

Animated Intro Section

A collection of fancy text effects, to animate the tagline and action buttons of your website intro section.
Browser support
  • ie
  • Chrome
  • Firefox
  • Safari
  • Opera
9+

Animations in web design are often used to drive the user’s focus to a specific section. One section  you want to make sure to highlight is the main tagline, with the action buttons. A good use of typography and a wise choice of colors should do the trick. However we decided to spice things up a little by creating some text effects that you can easily apply to the intro section of your web projects.

Video: Mazwai

Creating the structure

The HTML structure for each effect is pretty simple: a section.cd-intro is used as a container for the div.cd-intro-content which wraps the main tagline.

The structure for the main tagline slightly differs from one effect to the other: for the bouncy effect, for example, we used an <h1> for the page title, a <p> tag as tagline, and a div.action-wrapper to wrap the action buttons:

The .bouncy class added to the .cd-into-content is used to trigger the animation.

Adding style

By default, we hide the intro content by setting its opacity to zero, then we animate it using CSS Animations.
For the bouncy effect, for example, we created 3 different animations for the <h1>, <p> and .cd-btn buttons:

Let’s take a look at the video effect now: if you open the video.html file, you can see that an additional div.cd-bg-video-wrapper has been inserted; this element is used to wrap the background video (you won’t see any <video> element inside the HTML because it’s loaded using Javascript – more in the ‘Events Handling’ section).

Besides, we inserted two svg elements (.svg-mask and .svg-mask-mobile) inside the <h1>: these svgs are used to create the title transparency effect (the first one when the device width is bigger than 768px, the second for the other devices).
Basically, the idea is: we create an opaque rectangular <path> element but then we add a transparent area in the shape of the page title (in our demo, ‘Video Effect’).
The svg is then used as a layer to cover the entire .cd-intro-content: the transparent area of the svg lets you see what’s below it (the background video).

You can create a svg mask simply by using a vector graphic editor. We used Adobe Illustrator, where we created a rectangle and then removed the text using the pathfinder tool.

Events handling

These intro effects have been created using CSS only.
We used jQuery for the video effect only to load the background video if the device width is bigger than 768px. A data-video has been added to the  div.cd-bg-video-wrapper to retrieve the video url.

Changelog

Oct 29, 2015
  • Resource released by CodyHouse

Claudia Romano

Web developer, fan of The Big Bang Theory and good food. Co-founder of CodyHouse and Nucleo. You can follow her on Twitter.

  • Nitin

    Cool practical solution, as always. My favorite – Mask