Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="stage">
    <div class="line"></div>
    <div class="lemonheads">
        <div class="lemon lemon--1">
            <div class="cuboid cuboid--1">
                <div class="face face--front"><h1 class="word">lemonheads</h1><div class="base"></div></div>
                <div class="face face--back"><h1 class="word" aria-hidden="true">lemonheads</h1></div>
                <div class="face face--top"><h1 class="word" aria-hidden="true">bullet lavolta</h1></div>
                <div class="face face--bottom"><h1 class="word" aria-hidden="true">the pagans</h1></div>
            </div>
        </div>
        <div class="lemon lemon--2">
            <div class="cuboid cuboid--2">
                <div class="face face--front"><h1 class="word">lemonheads</h1><div class="base"></div></div>
                <div class="face face--back"><h1 class="word" aria-hidden="true">lemonheads</h1></div>
                <div class="face face--top"><h1 class="word" aria-hidden="true">bullet lavolta</h1></div>
                <div class="face face--bottom"><h1 class="word" aria-hidden="true">the pagans</h1></div>
            </div>
        </div>
        <div class="lemon lemon--3">
            <div class="cuboid cuboid--3">
                <div class="face face--front"><h1 class="word">lemonheads</h1><div class="base"></div></div>
                <div class="face face--back"><h1 class="word" aria-hidden="true">lemonheads</h1></div>
                <div class="face face--top"><h1 class="word" aria-hidden="true">bullet lavolta</h1></div>
                <div class="face face--bottom"><h1 class="word" aria-hidden="true">the pagans</h1></div>
            </div>
        </div>
        <div class="lemon lemon--4">
            <div class="cuboid cuboid--4">
                <div class="face face--front"><h1 class="word">lemonheads</h1><div class="base"></div></div>
                <div class="face face--back"><h1 class="word" aria-hidden="true">lemonheads</h1></div>
                <div class="face face--top"><h1 class="word" aria-hidden="true">bullet lavolta</h1></div>
                <div class="face face--bottom"><h1 class="word" aria-hidden="true">the pagans</h1></div>
            </div>
        </div>
        <div class="lemon lemon--5">
            <div class="cuboid cuboid--5">
                <div class="face face--front"><h1 class="word">lemonheads</h1><div class="base"></div></div>
                <div class="face face--back"><h1 class="word" aria-hidden="true">lemonheads</h1></div>
                <div class="face face--top"><h1 class="word" aria-hidden="true">bullet lavolta</h1></div>
                <div class="face face--bottom"><h1 class="word" aria-hidden="true">the pagans</h1></div>
            </div>
        </div>
        <div class="lemon lemon--6">
            <div class="cuboid cuboid--6">
                <div class="face face--front"><h1 class="word">lemonheads</h1><div class="base"></div></div>
                <div class="face face--back"><h1 class="word" aria-hidden="true">lemonheads</h1></div>
                <div class="face face--top"><h1 class="word" aria-hidden="true">bullet lavolta</h1></div>
                <div class="face face--bottom"><h1 class="word" aria-hidden="true">the pagans</h1></div>
            </div>
        </div>
        <div class="lemon lemon--7">
            <div class="cuboid cuboid--7">
                <div class="face face--front"><h1 class="word">lemonheads</h1><div class="base"></div></div>
                <div class="face face--back"><h1 class="word" aria-hidden="true">lemonheads</h1></div>
                <div class="face face--top"><h1 class="word" aria-hidden="true">bullet lavolta</h1></div>
                <div class="face face--bottom"><h1 class="word" aria-hidden="true">the pagans</h1></div>
            </div>
        </div>
    </div>
    <div class="guests info">
        <p>
            <span class="info-line"><span class="info-line__txt">with bullet lavolta</span><span class="info-line__bg"></span></span>
            <span class="info-line"><span class="info-line__txt">and the pagans</span><span class="info-line__bg"></span></span>
        </p>
    </div>
    <div class="date info">
        <p>
            <span class="info-line"><span class="info-line__txt">sunday, may 10 1987</span><span class="info-line__bg"></span></span>
            <span class="info-line"><span class="info-line__txt">3 pm / all ages</span><span class="info-line__bg"></span></span>
        </p>
    </div>
    <div class="location info">
        <p>
            <span class="info-line"><span class="info-line__txt">at t.t. the bear's place</span><span class="info-line__bg"></span></span>
            <span class="info-line"><span class="info-line__txt">cambridge, massachusetts</span><span class="info-line__bg"></span></span>
        </p>
    </div>
    <div class="presented info">
        <p>
            <span class="info-line"><span class="info-line__txt">presented by</span><span class="info-line__bg"></span></span>
            <span class="info-line"><span class="info-line__txt">whrb's record hospital</span><span class="info-line__bg"></span></span>
        </p>
    </div>
</div>
              
            
!

CSS

              
                /*  ==========================================================
	MIXINS
	========================================================== */
	
@mixin cuboid($cWidth, $cHeight, $cDepth, $cColor) {
	position: relative;
	width: $cWidth;
	height: $cHeight;
	transform-style: preserve-3d;
	
	.face {
		position: absolute;
		left: 0;
		top: 0;
		background-color: $cColor;
	}
	
	.face--front {
		width: $cWidth;
		height: $cHeight;
		transform: translateZ(calc(#{$cDepth}/2));
	}

	.face--back {
		width: $cWidth;
		height: $cHeight;
		transform: translateZ(calc(#{$cDepth}/2 *-1)) rotateY(180deg) rotate(180deg);
	}

	.face--left {
		width: $cDepth;
		height: $cHeight;
		transform: translateX(calc(#{$cDepth}/2 *-1)) rotateY(-90deg);
	}

	.face--right {
		width: $cDepth;
		height: $cHeight;
		transform: translateX(calc(#{$cWidth} - #{$cDepth}/2)) rotateY(90deg);
	}

	.face--top {
		width: $cWidth;
		height: $cDepth;
		transform: translateY(calc(#{$cDepth}/2 * -1)) rotateX(90deg);
	}

	.face--bottom {
		width: $cWidth;
		height: $cDepth;
		transform: translateY(calc(#{$cHeight} - #{$cDepth}/2)) rotateX(-90deg);
	}
}

/*  ==========================================================
	MAIN
	========================================================== */

$yellow: #FFDD00;
$black: #00000A;

html {
	box-sizing: border-box;
}

*, *:before, *:after {
	box-sizing: inherit;
}

html, body {
	width: 100%;
	height: 100%;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: black;
    font-family: neue-haas-grotesk-display, "Helvetica Neue", Helvetica, sans-serif;
    font-weight: 600;
    font-display: block;
    color: white;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

.stage {
	position: relative;
	min-width: 716px;
	width: 716px;
	height: 1008px;
    background-color: $yellow;
    overflow: hidden;
	visibility: hidden;
    cursor: pointer;
    
    // &:before {
    //     position: absolute;
    //     z-index: 1;
    //     display: block;
    //     content: '';
    //     width: 100%;
    //     height: 100%;
    //     opacity: 0.5;
    // }
}

.line {
    position: absolute;
    left: 27px;
    z-index: 10;
    width: 50px;
    background: rgba(black, 0.4);
    height: 100%;
    display: none;
}

.lemonheads {
    width: 716px;
    height: 718px;
    overflow: hidden;
}

.lemon {
    position: relative;
    left: 0;
    z-index: 2;
    overflow: hidden;
}

.lemon--1 {
    height: 53px;
}

.lemon--2 {
    height: 65px;
}
.lemon--3 {
    height: 78px;
}
.lemon--4 {
    height: 96px;
}
.lemon--5 {
    height: 116px;
}
.lemon--6 {
    height: 141px;
}
.lemon--7 {
    height: 169px;
}

.word {
    will-change: transform;
}

.cuboid {
    position: absolute;
    will-change: transform;
    // backface-visibility: hidden;
}

.cuboid--1 {
    @include cuboid(276px, 53px, 53px, $black);
    
    .word {
        bottom: -6.0px;
        left: 23.6px;
        font-size: 43.5px;
        letter-spacing: 0.5px;
    }
}

.cuboid--2 {
    @include cuboid(323px, 65px, 65px, $black);
    
    .word {
        bottom: -6px;
        left: 22.7px;
        font-size: 50.5px;
        letter-spacing: 1px;
    }
}

.cuboid--3 {
    @include cuboid(379px, 78px, 78px, $black);
    
    .word {
        bottom: -7.4px;
        left: 21.7px;
        font-size: 59.8px;
        // letter-spacing: -1.5px;
    }
}

.cuboid--4 {
    @include cuboid(445px, 96px, 96px, $black);
    
    .word {
        bottom: -9.2px;
        left: 21px;
        font-size: 70.5px;
        // letter-spacing: -1.5px;
    }
}

.cuboid--5 {
    @include cuboid(522px, 116px, 116px, $black);
    
    .word {
        bottom: -9.2px;
        left: 19.7px;
        font-size: 83px;
        // letter-spacing: -1.5px;
    }
}

.cuboid--6 {
    @include cuboid(610px, 141px, 141px, $black);
    
    .word {
        bottom: -8.5px;
        left: 18.2px;
        font-size: 97.6px;
        // letter-spacing: -1.5px;
    }
}

.cuboid--7 {
    @include cuboid(716px, 169px, 169px, $black);
    
    .word {
        bottom: -9.2px;
        left: 16.7px;
        font-size: 113.5px;
        // letter-spacing: 2px;
    }
}

.face {
    position: relative;
    overflow: hidden;
}

.base {
    width: 100%;
    height: 100%;
    background: #FFDD00;
}

.word {
    position: absolute;
    margin: 0;
    color: $yellow;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 2.5px;
}

p {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.27px;
    line-height: 1.28;
    color: $black;
}

.info-line {
    position: relative;
    display: block;
}

.info-line__txt {
    opacity: 0;
}

.info-line__bg {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    background: $black;
}

.guests {
    position: absolute;
    z-index: 2;
    top: 857px;
    left: 25px;
}

.date {
    position: absolute;
    z-index: 2;
    top: 928px;
    left: 25px;
}

.location {
    position: absolute;
    z-index: 2;
    top: 928px;
    left: 243px;
}

.presented {
    position: absolute;
    z-index: 2;
    top: 928px;
    left: 512px;
}
              
            
!

JS

              
                console.clear();

select = e => document.querySelector(e);
selectAll = e => document.querySelectorAll(e);

const stage = select('.stage');
let master = gsap.timeline({delay: 1});

function animateIntro() {

    let tl = gsap.timeline();
    
    tl.to('.base', {
        scaleX: 0,
        duration: 3,
        ease: 'power4.inOut',
        transformOrigin: 'right center',
        stagger: 0.1
    })
    .from('.face--front .word', {
        x: '70%',
        duration: 3,
        ease: 'power4',
        stagger: 0.1
    }, 0)
    
    return tl;
}

function animateInfo() {
    let tl = gsap.timeline();
    let targets = gsap.utils.toArray(".info"); 
    
    targets.forEach(function(item, i){
        
        let bg = item.querySelectorAll('.info-line__bg');
        let txt = item.querySelectorAll('.info-line__txt')
        
        console.log(i);
        
        let ttl = gsap.timeline({
            defaults: {
                duration: 1,
                stagger: 0.15
            }
        });
        
        ttl.from(bg, {
            scaleX: 0,
            ease: 'power2.in',
            transformOrigin: 'left top'
        })
        .set(txt, { 
            opacity: 1
        })
        .to(bg, {
            scaleX: 0,
            ease: 'power2',
            transformOrigin: 'right top'
        })
        
        tl.add(ttl, i/8);
    });
    
    return tl;
}

function animateRotation() {
    
    let tl = gsap.timeline({ 
        repeat: -1, 
        repeatDelay: 1,
        defaults: {
            stagger: 0.1,
            // ease: 'expo',
            duration: (i) => 2 + (i * 0.4)
        }
    });
    
    tl.to('.cuboid', {
        rotateX: -180,
        ease: 'power2.inOut'
    })
    // .to('.face--front .word', {
    //     y: "50%",
    //     ease: 'sine.in'
    // }, 0)
    .set('.face--front .word', { y: 0 })
    .from('.face--back .word', {
        y: '-100%',
        duration: (i) => 5 + (i * 0.2),
        ease: 'power2',
        immediateRender: false
    }, 0)
    
    .to('.cuboid', {
        rotateX: -360,
        ease: 'power2.inOut'
    }, 8)
    // .fromTo('.face--back .word', {
    //     y: 0
    // },{
    //     y: "50%",
    //     ease: 'sine.in',
    //     immediateRender: false
    // }, 8)
    .fromTo('.face--front .word', {
        y: '-100%'
    },{
        y: '0%',
        duration: (i) => 5 + (i * 0.2),
        ease: 'power2',
        immediateRender: false
    }, 8)
    
    return tl;
}

function init() {
    gsap.set(stage, { autoAlpha: 1 });
    gsap.set('.cuboid', { transformPerspective: 800, transformOrigin: 'left center' });
    master.add(animateIntro()).add(animateRotation(), "-=1.7").add(animateInfo(), 1.5);

    stage.onclick = () => {
        master.restart();
    }
}

function resize() {
	let vh = window.innerHeight;
	let sh = stage.offsetHeight;
	let scaleFactor = vh/sh;
	if(scaleFactor<1) {
		gsap.set(stage, { scale: scaleFactor });
	}
	else {
        gsap.set(stage, { scale: 1 });
    }
}

window.onresize = resize;

window.onload = () => {
	init();
    resize();
    // GSDevTools.create();
};
              
            
!
999px

Console