cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="hero">
  <div class="reveal_hero_block"></div>
  <span class="hero_title">Block Reveal Effect<span class="hero_subtitle">using GASP, ScrollMagic, and CSS3 ---> inspired by Media Election</span></span>
</div>

<!-- image 1 -->
<div class="reveal_main">
  <div class="reveal_main-text">
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Web Design '17</h1>
    </div>
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Block reveal effect</h1>
    </div>
  </div>
  <div class="reveal_cont-img">
    <div class="reveal_block-img"></div>
    <img class="reveal_img" src="http://artskidesign.com/archive/wp-content/uploads/block-reveal/2.jpg" />
  </div>
</div>

<!-- image 2 -->
<div class="reveal_main left">
  <div class="reveal_cont-img">
    <div class="reveal_block-img"></div>
    <img class="reveal_img" src="http://artskidesign.com/archive/wp-content/uploads/block-reveal/1.jpg" />
  </div>
  <div class="reveal_main-text">
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Web Design '17</h1>
    </div>
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Block reveal effect</h1>
    </div>
  </div>
</div>

<!-- image 3 -->
<div class="reveal_main">
  <div class="reveal_main-text">
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Web Design '17</h1>
    </div>
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Block reveal effect</h1>
    </div>
  </div>
  <div class="reveal_cont-img">
    <div class="reveal_block-img"></div>
    <img class="reveal_img" src="http://artskidesign.com/archive/wp-content/uploads/block-reveal/3.jpg" />
  </div>
</div>

<!-- image 4 -->
<div class="reveal_main left">
  <div class="reveal_cont-img">
    <div class="reveal_block-img"></div>
    <img class="reveal_img" src="http://artskidesign.com/archive/wp-content/uploads/block-reveal/4.jpg" />
  </div>
  <div class="reveal_main-text">
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Web Design '17</h1>
    </div>
    <div class="reveal_cont-text">
      <div class="reveal_block"></div>
      <h1 class="reveal_text">Block reveal effect</h1>
    </div>
  </div>
</div>
            
          
!
            
              /* Body and hero styling */

body {
  margin: 0;
  padding: 0;
  font-family: Helvetica, sans-serif;
  font-weight: bold;
  color: white;
}

.hero {
  background: url(http://artskidesign.com/archive/wp-content/uploads/block-reveal/4.jpg) no-repeat center center;
  background-size: cover;
  width: 100%;
  height: 100vh;
  margin-bottom: 15em;
  display: table;
  text-align: center;
  overflow: hidden;
}

.hero span {
  line-height: 1.5;
}

.hero_title {
  font-size: 4em;
  display: table-cell;
  vertical-align: middle;
}

.hero_subtitle {
  font-size: 0.3em;
  font-weight: 300;
  display: block;
}

.reveal_hero_block {
  position: absolute;
  min-width: 130px;
  height: 10%;
  background-color: red;
  z-index: 1;
}

.reveal_hero_block {
  left: 50%;
  transform: translate(-50%, -50%);
}


/* Reveal Main CSS */

.reveal_main {
  overflow: hidden;
  margin: auto;
  margin-bottom: 40em;
  display: table;
}

.reveal_main-text {
  display: table-cell;
  vertical-align: middle;
}

.reveal_cont-text {
  position: relative;
  max-width: 100%;
  height: auto;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
}

.reveal_block {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  width: 100%;
  height: 100%;
  background-color: red;
  display: inline-block;
  z-index: 1;
}

.reveal_text {
  position: relative;
  font-size: 5vw;
  margin: 0;
  white-space: nowrap;
  color: black;
  opacity: 0;
  visibility: hidden;
}

.reveal_cont-img {
  position: relative;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  font-size: 0;
  z-index: -1;
}

.reveal_block-img {
  position: absolute;
  display: block;
  width: 100%;
  height: 100%;
  background-color: red;
}

.reveal_img {
  display: inline-block;
  max-width: 150%;
  height: auto;
  opacity: 0;
  visibility: hidden;
}


/* Media queries */

@media screen and (max-width:61.59em) {
  .reveal_cont-img {
    transform: translate(0%, 0%)!important;
  }
}
            
          
!
            
              // init
var controller = new ScrollMagic.Controller();

// loop 
$('.reveal_main').each(function() {
      var loaderInit = new TimelineMax();

      // tween variables
      if ($(this).hasClass('left')) {
        var imgSet = 20,
          imgBlockFrom = -101,
          imgBlockTo = 101,
          contTextSet = -30,
          textBlockStaggerFrom = 101,
          textBlockStaggerTo = -101;
      } else {
        var imgSet = -20,
          imgBlockFrom = 101,
          imgBlockTo = -101,
          contTextSet = 30,
          textBlockStaggerFrom = -101,
          textBlockStaggerTo = 101;
      }
  
// build a tween
  loaderInit
    .set($(this).find('.reveal_cont-img'), {autoAlpha:1,xPercent:imgSet},0)
    .from($(this).find('.reveal_block-img'), 0.325,{xPercent:imgBlockFrom, ease:Power1.easeOut})
    .set($(this).find('.reveal_img'), {autoAlpha:1})
    .to($(this).find('.reveal_block-img'), 0.225,{xPercent:imgBlockTo, ease:Sine.easeOut})
    .set($(this).find('.reveal_cont-text'), {autoAlpha:1,xPercent:contTextSet},0.3)
   
    // stagger text blocks and text
    .staggerFromTo($(this).find('.reveal_block'), 0.7, {xPercent:textBlockStaggerFrom, ease:Power1.easeOut}, {xPercent:textBlockStaggerTo, ease:Power1.easeOut},0.25)
    .add('blocksEnd')
    .staggerTo($(this).find('.reveal_text'), 0.1, {autoAlpha:1},0.25,'blocksEnd-=0.75')
  
//  build a scene
  var scene = new ScrollMagic.Scene({
    triggerElement: this,
    triggerHook:'onEnter',
    offset:700
    
  })
  .setTween(loaderInit)
  .addTo(controller)  
});



// Hero block init
var ctrl = new ScrollMagic.Controller();

// loop 
var heroBlockfx = new TimelineMax();

// build a tween
heroBlockfx    
    .fromTo('.reveal_hero_block',0.6, {yPercent:100, ease:Power0.easeOut}, { yPercent:300, ease:Elastic.easeOut})
    .to('.reveal_hero_block',0.25, {rotation:180, ease:Sine.easeOut})

//  build a scene
  var scene = new ScrollMagic.Scene({
    triggerElement: $('.hero'),
    triggerHook:'onEnter',
    offset:-10   
  })
  .setTween(heroBlockfx)
  .addTo(ctrl)
  
  



            
          
!
999px
Loading ..................

Console