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

              
                <!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Pentanet | Awareness | MRec</title>

        <meta name="ad.size" content="width=300,height=250">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="stylesheet" type="text/css" href="styles.css" media="all">

        <!-- Studio Enabler -->
        <script src="https://s0.2mdn.net/ads/studio/Enabler.js"></script>

        <!-- Additional JS -->
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="https://s0.2mdn.net/ads/studio/cached_libs/tweenmax_2.1.2_min.js"></script>
        <script type="text/javascript" src="js/script.js"></script>

        <style>
            #ad.loading { background: none #262626; }
        </style>
    </head>

    <body>
        <!-- List of Classes: svg-sprite img-sprite vertical-align out-of-canvas retina-ready visible -->

        <div id="ad" class="loading">
            <button id="clickthrough-button" class="button clickthrough"></button>

            <!-- <img class="tracking-pixel vertical-align" SRC="" BORDER="0" HEIGHT="1" WIDTH="1" ALT="Advertisement"> -->

            <div id="banner">
                <div id="scene-01" class="scene-wrapper">
                    <div id="text-01-01" class="img-sprite retina-ready vertical-align"></div>

                    <div id="text-02" class="img-sprite visible vertical-align">
                        <div id="text-02-01" class="img-sprite vertical-align"></div>
                        <div id="text-02-02" class="img-sprite vertical-align"></div>
                        <div id="text-02-03" class="img-sprite vertical-align"></div>
                    </div>

                    <div id="text-03" class="img-sprite visible vertical-align">
                        <div id="text-03-01" class="img-sprite vertical-align"></div>
                        <div id="text-03-02" class="img-sprite vertical-align"></div>
                    </div>

                    <div id="text-04" class="img-sprite visible vertical-align">
                        <div id="text-04-02" class="img-sprite vertical-align"></div>
                        <div id="text-04-01" class="img-sprite retina-ready vertical-align"></div>
                        <div id="text-04-03" class="img-sprite vertical-align"></div>
                        <div id="text-04-04" class="img-sprite vertical-align"></div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
              
            
!

CSS

              
                /* Base CSS HTML5 Ad Campaign v01 | Kevin Mario 2016 ( @kevinMario ) */
/* Give credit where credit is due - thanks! ;) */

* {
    border: 0;
    padding: 0;
    margin: 0;

    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

body, html {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #fff;
}

#ad, #clickthrough-button, .scene-wrapper {
    position: absolute;
    display: block;
    width: 300px;
    height: 250px;

    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
    #scene-02 { z-index: 500; }
    #scene-03 { z-index: 1000; }
    #scene-04 { z-index: 1500; }

#ad {
    border: 1px solid #000;
    background-color: #262626;
    -moz-user-select: -moz-none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow: hidden;
}
    .scene-wrapper {
        top: -2px;
        left: -2px;
    }

#banner { opacity: 1; }

#ad.loading {
    background: url("images/ajax-loader.gif") center center no-repeat;
}

    #ad.loading #banner { opacity: 0; }

#clickthrough-button {
    background-color: transparent;
    cursor: pointer;
    z-index: 999999;
}

#background, #second-background {
    width: 300px;
    height: 250px;
    opacity: 0;
}

#background { background: top left no-repeat; }

.svg-sprite, .img-sprite, .text-element {
    position: absolute;
    z-index: 100;
    opacity: 0;
}

.svg-sprite { background-size: cover; }

.vertical-align {
    margin: auto;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.vertical-align.out-of-canvas {
    top: -1000%;
    left: -1000%;
    right: -1000%;
    bottom: -1000%;
}

#video-container {
    position: absolute;
    width: 260px;
    height: 165px;

    top: auto;
    bottom: 35px;

    opacity: 0;
    z-index: -1;
}

#video-container video {
    width: 100%;
    height: 100%;
}

#ad.animation-finished #video-container { z-index: 1000000; }

.retina-ready { background-size: 300px 250px !important; }
.visible { opacity: 1; }

.tracking-pixel {
    position: absolute;
    display: block;
    visibility: visible;
    opacity: 1;
    z-index: 1000001;
}

/* ================================ */
/* START CREATIVE SPECIFIC ELEMENTS */

#text-01-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-01-01.png?v=1");  }

#text-02-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-02-01.png");  }
#text-02-02 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-02-02.png");  }
#text-02-03 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-02-03.png");  }

#text-03-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-03-01.png");  }
#text-03-02 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-03-02.png");  }

#text-04-01 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-01.png");  }
#text-04-02 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-02.png");  }
#text-04-03 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-03.png");  }
#text-04-04 { background-image: url("http://www.lunarist.com/snippets/2019/0910/mrec/text-04-04.png");  }
              
            
!

JS

              
                // DoubleClick Specs HTML5 Ad Campaign v02 | Kevin Mario 2016 ( @kevinMario )
// v01: Initial Template
// v02: Updated with DCRM JS Template
// Give credit where credit is due - thanks! ;)

var container;
var content;
var bgExit;
var tl;

//Function confirm if the creative is visible   
enablerInitHandler = function(e) {
    /*if(Enabler.isVisible()) {
        startAd();
    } else {
        Enabler.addEventListener(studio.events.StudioEvent.VISIBLE, startAd);
    } */

    // Polite Loading as per Spec
    if (Enabler.isPageLoaded()) {
        startAd();
    } else {
        Enabler.addEventListener(studio.events.StudioEvent.PAGE_LOADED, startAd);
    }
};

//Start the creative
startAd = function(e) {
    //Assign All the elements to the element on the page
    container = document.getElementById('ad');
    //content = document.getElementById('content_dc');    
    bgExit = document.getElementById('clickthrough-button');

    //Add listeners
    addListeners();

    container.style.display = "block";
    container.className = "";

    console.log("Ad Initialized");

    // var video1 = document.getElementById('video1');
    //$("#video1").prop("muted", true);

    // Enabler.loadModule(studio.module.ModuleId.VIDEO, function() {
    //     studio.video.Reporter.attach('video_1', video1);
    // });

    startAnimation();
};

//Add Event Listeners
addListeners = function(e) {
    bgExit.addEventListener('touchEnd', bgExitHandler, false);
    bgExit.addEventListener('click', bgExitHandler, false);
};

//Add exits
bgExitHandler = function(e) {   
    Enabler.exit('HTML5_Background_Clickthrough');
};

//Wait for the content to load to call the start od the ad
window.onload = function(){
    if (Enabler.isInitialized()) {
        enablerInitHandler();
    } else {
        Enabler.addEventListener(studio.events.StudioEvent.INIT, enablerInitHandler);
    }
};


// ANIMATION TIMELINE
function startAnimation() {
    console.log("Animation Start");

    tl = new TimelineLite();

    function pauseLine() {
        tl.pause();
    }

    function playLine() {
        tl.play();
    }

    TweenLite.defaultOverwrite = false;

    tl
        .fromTo("#text-01-01", .35, 
            {alpha: 0, scale: .125, ease: Sine.easeOut}, 
            {alpha: 1, scale: .95, ease: Sine.easeOut}, 
        "0")

        /*.to("#text-01-01", 2, {scale: 1.125, ease: Sine.easeOut}, "-=0.015")
        .to("#text-01-01", .125, {scale: 2, ease: Sine.easeOut}, "-=0.015")
        .to("#text-01-01", .075, {alpha: 0, ease: Sine.easeOut}, "-=.125")*/

        .to("#text-01-01", 2, {scale: 1.125, ease: Sine.easeOut}, ".335")
        .to("#text-01-01", .125, {scale: 2, ease: Sine.easeOut}, "2.125")
        .to("#text-01-01", .075, {alpha: 0, ease: Sine.easeOut}, "2.125")



        .fromTo("#text-02-01", .25, 
            {alpha: 0, x: -150, ease: Sine.easeOut}, 
            {alpha: 1, x: 0, ease: Sine.easeOut}, 
        "-=.075")

        .fromTo("#text-02-02", .25, 
            {alpha: 0, x: -150, ease: Sine.easeOut}, 
            {alpha: 1, x: 0, ease: Sine.easeOut}, 
        "+=.075")

        .fromTo("#text-02-03", .25, 
            {alpha: 0, x: -150, ease: Sine.easeOut}, 
            {alpha: 1, x: 0, ease: Sine.easeOut}, 
        "+=.075")

        .to("#text-02", .25, { alpha:0, ease: Sine.easeOut}, "+=1.5")



        .fromTo("#text-03-01", .25, 
            {alpha: 0, x: -150, ease: Sine.easeOut}, 
            {alpha: 1, x: 0, ease: Sine.easeOut}, 
        "-=.25")

        .fromTo("#text-03-02", .25, 
            {alpha: 0, x: -150, ease: Sine.easeOut}, 
            {alpha: 1, x: 0, ease: Sine.easeOut}, 
        "+=.075")

        .to("#text-03", .25, { alpha:0, ease: Sine.easeOut}, "+=1.5")



        .fromTo("#text-04-02", 1.25, 
            {alpha: 0, y: 10, ease: Sine.easeOut}, 
            {alpha: 1, y: 0, ease: Sine.easeOut}, 
        "-=.25")

        .fromTo("#text-04-01", .75, 
            {alpha: 0, y: -5, ease: Sine.easeOut}, 
            {alpha: 1, y: 0, ease: Sine.easeOut}, 
        "-=1.15")

        .fromTo("#text-04-03", .75, 
            {alpha: 0, y: 5, ease: Sine.easeOut}, 
            {alpha: 1, y: 0, ease: Sine.easeOut}, 
        "-=.75")

        .fromTo("#text-04-04", .75, 
            {alpha: 0, scale: 1.75, y: -80, ease: Bounce.easeOut}, 
            {alpha: 1, scale: 1, y: 0, ease: Bounce.easeOut}, 
        "-=.25")


        .to("#text-01-01", .05, {alpha: 0, scale: .125, ease: Sine.easeOut }, "+=4")
        
        .to("#text-04", .125, { alpha: 0, scale: 2, ease: Sine.easeOut,
            onComplete: function() { 
                $("#text-01-01").removeAttr("style")
                tl.restart();
            }
        }, "-=.05")


    /*
        .fromTo("element", 0, 
            {alpha: 0, ease: Sine.easeOut}, 
            {alpha: 1, ease: Sine.easeOut}, 
        "0")

        .to("element", .25, {alpha:0, x: 250, ease: Sine.easeOut}, "+=3")
    
        .staggerFromTo("element", .75, 
            {alpha: 0, y: -200, transformOrigin:'850px 55px', ease:Bounce.easeOut}, 
            {alpha: 1, y: 0, transformOrigin:'850px 55px', ease:Bounce.easeOut}, 
        .15, "-=.5")

        .fromTo("#video-container", .75, 
            {alpha: 0, scale:1.05, ease: Sine.easeOut}, 
            {alpha: 1, scale: 1, ease: Sine.easeOut, 
                onComplete: function() {
                    $("#ad").addClass("animation-finished"); 
                    $("#video1").get(0).play();
                }},
        "+=.5")
    */

        //.tl.call(pauseLine)
    ;

    // Test Animation
    //tl.seek(5);
}
              
            
!
999px

Console