Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<article>
<section class="reveal-gallery">
                <h2 class="chapter">
                    Our Values
                </h2>

                <div class="rg__column left" data-color="#a6b3b3">
                    <div class="rg__text">
                        <div class="rg__text--heading">
                            <span>01</span>
                            <h3>Adipisicing Elitare</h3>
                        </div>
                        <div class="rg__text--copy">
                            <div class="rg__text--mask">
                                <p>Lorem ipsum dolor sit amet consectetur.</p>
                            </div>
                        </div>
                    </div>
                    <div class="rg__image">
                        <div class="rg__image--mask">
                            <img src="https://w.wallhaven.cc/full/rd/wallhaven-rddgwm.jpg" />
                        </div>
                    </div>
                </div>
                <div class="rg__column center" data-color="#b0a7a4">
                    <div class="rg__text">
                        <div class="rg__text--heading">
                            <span>02</span>
                            <h3>Accusamus Accusantium</h3>
                        </div>
                        <div class="rg__text--copy">
                            <div class="rg__text--mask">
                                <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Voluptas aut veritatis.</p>
                            </div>
                        </div>
                    </div>
                    <div class="rg__image">
                        <div class="rg__image--mask">
                            <img src="https://w.wallhaven.cc/full/6o/wallhaven-6oqzgq.jpg" />
                        </div>
                    </div>
                </div>
                <div class="rg__column right" data-color="#a3abb1">
                    <div class="rg__text">
                        <div class="rg__text--heading">
                            <span>03</span>
                            <h3>Ratione Quibusdam</h3>
                        </div>
                        <div class="rg__text--copy">
                            <div class="rg__text--mask">
                                <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Voluptas aut veritatis nostrum ratione quibusdam ea non laudantium accusamus accusantium molestias.</p>
                            </div>
                        </div>
                    </div>
                    <div class="rg__image">
                        <div class="rg__image--mask">
                            <img src="https://w.wallhaven.cc/full/72/wallhaven-7232p9.jpg" />
                        </div>
                    </div>
                </div>
            </section>
</article>
              
            
!

CSS

              
                :root {
    --text-color: white;
    --text-dark-color: #202020;
    --header-height: 100px;
    --burger-width: 40px;
    --font-headings: Georgia, serif;
    --bcg-green: #ACB7AE;
    --bcg-lightgreen: #a6b3b3;
    --bcg-lightbrown: #b0a7a4;
    --bcg-lightblue: #a3abb1;
    --bcg-loaderblue: #758A94;
    --bcg-loaderbluedark: #566C76;
    --bcg-fill-color: var(--bcg-green);
    --loader-width: 27.36vw;
    --loader-height: 50vh;
    --v-spacing: 10vh;
    --h-gutter: 6.6vw;
    --easing: cubic-bezier(0.5, 0.7, 0.4, 1);
}

body {
    font: 16px/1.7 'Source Sans Pro', Helvetica, Helvetica Neue, Arial, sans-serif;
    color: var(--text-dark-color);
}

.hg__image,
.rg__image {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #000000;
    pointer-events: none;
}

.hg__image--l {
    width: 18vw;
    padding-bottom: 26vw;
}

.hg__image--m {
    width: 18vw;
    padding-bottom: 26.55vw;
}

.hg__image--s {
    width: 13vw;
    padding-bottom: 19vw;
}

.hg__image img,
.rg__image img,
.blog__image img,
.stage__image img,
.loader__image img {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    object-fit: cover;
    object-position: 50% 50%;
    opacity: 0.8
}

.hg__left .hg__image:nth-child(1) {
    top: 17vh;
    left: 15vw;
}

.hg__left .hg__image:nth-child(2) {
    top: 30vh;
    left: 6vw;
}

.hg__left .hg__image:nth-child(3) {
    top: 56vh;
    left: 14vw;
}

.hg__right .hg__image:nth-child(1) {
    top: 15vh;
    left: auto;
    right: 21vw;
    width: 24vw;
    padding-bottom: 21vw;
}

.hg__right .hg__image:nth-child(2) {
    top: 27vh;
    left: auto;
    right: 10vw;
}

.hg__right .hg__image:nth-child(3) {
    top: 56vh;
    left: auto;
    right: 19vw;
    width: 16vw;
    padding-bottom: 20vw;
    z-index: 1;
}


/* =Reveal Gallery */

.reveal-gallery {
    width: 100%;
    height: 104vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    color: var(--text-color);
    position: relative;
    z-index: 1;
}

.rg__column {
    flex-grow: 1;
    /* equivalent to 33.33% */
    padding: 0 var(--h-gutter);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.rg__text--heading h3 {
    font-size: 3.6vw;
    line-height: 1.192307692;
}

.rg__text--heading span {
    font-size: 2vw;
    opacity: 0.5;
}

.rg__text--heading h3,
.rg__text--heading span,
.chapter {
    font-family: var(--font-headings);
    font-weight: normal;
}

.rg__text {
    max-width: 17vw;
    z-index: 1;
    position: relative;
}

.rg__text--copy,
.stage__text p {
    font-weight: 300;
    letter-spacing: .03vw;
}

.rg__text--copy p {
    margin: 0
}

.rg__column::before {
    display: block;
    position: absolute;
    top: 50%;
    left: 0;
    content: '';
    width: 1px;
    height: 20vh;
    transform: translateY(-50%);
    background-color: var(--text-color);
    opacity: 0.4
}

.rg__image {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.rg__image--mask {
    height: 100%;
    overflow: hidden;
}

.rg__image img {
    opacity: 0.6;
}

.rg__text--copy {
    position: absolute;
    overflow: hidden;
}

.rg__text--mask {
    overflow: hidden;
}



/* =Main */

main {
    z-index: 1;
    position: relative;
}

section {
    position: relative;
}

.with-padding {
    padding: var(--v-spacing) 0;
}

.with-padding-bottom {
    padding-bottom: var(--v-spacing);
}

.chapter {
    position: absolute;
    left: var(--h-gutter);
    top: var(--v-spacing);
    z-index: 2;
    color: var(--text-color);
    font-size: 1.6vw;
}

.chapter span {
    opacity: 0.4;
}


@media only screen and (min-width: 480px) {}

@media only screen and (min-width: 768px) {}

@media only screen and (min-width: 1140px) {}
              
            
!

JS

              
                import * as gsap from "https://cdn.skypack.dev/gsap@3.6.1";
function initHoverReveal() {
    
    sections.forEach(section => {

        // get componenets for animation
        section.imageBlock = section.querySelector('.rg__image');
        section.image = section.querySelector('.rg__image img');
        section.mask = section.querySelector('.rg__image--mask');
        section.text = section.querySelector('.rg__text');
        section.textCopy = section.querySelector('.rg__text--copy');
        section.textMask = section.querySelector('.rg__text--mask');
        section.textP = section.querySelector('.rg__text--copy p');

        // reset the initial position
        gsap.set([section.imageBlock, section.textMask], { yPercent: -101});
        gsap.set([section.mask, section.textP], { yPercent: 100});
        gsap.set(section.image, { scale: 1.2});

        // add event listeners to each section
        section.addEventListener('mouseenter', createHoverReveal);
        section.addEventListener('mouseleave', createHoverReveal);

    });
}

function createHoverReveal(e){
    // console.log(e.type);

    const { imageBlock, mask, text, textCopy, textMask, textP, image, dataset } = e.target;

    const { color } = dataset;

    let tl = gsap.timeline({
        defaults: {
            duration: 1.8,
            ease: 'power4.out'
        }
    });

    if(e.type === 'mouseenter'){

        tl
            .to([mask, imageBlock, textMask, textP], {
                yPercent: 0, 
                onStart: () => updateBodyColor(color)
            })
            .to(text, {y: () => -getTextHeight(textCopy)/2}, 0)
            .to(image, {duration: 1.1, scale: 1}, 0);

    } else if(e.type === 'mouseleave') {

        tl
            .to([mask, textP], {yPercent: 100})
            .to([imageBlock, textMask], {yPercent: -101}, 0)
            .to(text, {y: 0}, 0)
            .to(image, {scale: 1.2}, 0);

    }

    return tl;

}

function init(){
  
    initHoverReveal();  
}
              
            
!
999px

Console