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

              
                <div ng-app="gridReveal" ng-controller="RevealController" >
  
  <div id="stage" gs-scale>
    <div id="header"></div>
    <!-- mockup for now -->
    <div id="grid"></div>
    <button id="tile" class="pharrell" ng-click="showDetails(album)" aria-label="{{ album.aria.artist  }}"></button>
    <div id="nowPlaying"></div>

    <!-- This is the exploding 'reveal' view area -->
    <div id="details" class="hidden" >
      <div class="content">
        <div id="status" ></div>
        <div id="artist" ></div>
        <div id="circle" ></div>
        <div id="playlist" ng-click="hideDetails()" role='button'>
          <img ng-src="{{album.playlist}}">
        </div>
        <div id="album"></div>
      </div>
    </div>
  </div>    

 <!-- The AngularJS/GSAP DSL markup -->
 <gs-timeline state="zoom" time-scale="1.0" >

        <gs-step target="#circle"       style="scale:1.2;opacity:0"     ></gs-step>
        <gs-step target="#album"        style="left:-400;top:-400;"     ></gs-step>
        <gs-step target="#details"      style="display:none;"           ></gs-step>
        <gs-step target="#album"        style="display:none;opacity:1"  ></gs-step>
        <gs-step target="#album"        style="bounds:{{ album.from }}" ></gs-step>
        <gs-step target="#details"      style="display:block;"          ></gs-step>
        <gs-step target="#album"        style="display:block;"          ></gs-step>
        <gs-step target="#nowPlaying"   style="z-index:100;"            ></gs-step>
        <gs-step mark-position="start"                                  ></gs-step>
        <gs-step target="#nowPlaying"   style="z-index:100; top:602"    duration="0.2"></gs-step>
        <gs-step target="#circle"       style="opacity:1;"              duration="0.01"  position="start"></gs-step>
        <gs-step target="#circle"       style="scale:4;"                duration="0.3"   position="start+=0.01"></gs-step>
        <gs-step target="#circle"       style="scale:5;opacity:0.85"    duration="0.1"   position="start+=0.31"></gs-step>
        <gs-step target="#circle"       style="delay:0.2; opacity:0"    duration="0.4"   position="start+=0.5"></gs-step>
        <gs-step target="#artist"       style="opacity:1"               duration="0.8"   position="start"></gs-step>
        <gs-step target="#status"       style="opacity:1"               duration="0.8"   position="start"></gs-step>
        <gs-step target="#album"        style="bounds:{{ album.switchOver }}"  duration="0.33"   position="start"></gs-step>
        <gs-step target="#playlist"     style="bounds:{{ album.switchOver }};"                   position="start+=0.33"></gs-step>
        <gs-step target="#playlist"     style="display:block;className:'';"    duration="0.010"  position="start+=0.33"></gs-step>
        <gs-step target="#album"        style="opacity:0;display:none"         duration="0.010"  position="start+=0.33"></gs-step>
        <gs-step target="#playlist"     style="className:'shadow'"                       position="start+=0.34"></gs-step>
        <gs-step target="#playlist"     style="bounds:{{ album.to }}"   duration="0.5"   position="start+=0.34"></gs-step>

    </gs-timeline>
  
</div>
              
            
!

CSS

              
                body {
    margin: 0;
    padding: 0;
    background-color: #3e3e3e;
    padding: 10px;
}

#stage {
    position: relative;
    height: 602px;
    width: 855px;
    z-index: 0;
    overflow: hidden;
    text-overflow: clip;
    background-color: #1A0B1A;
    background-size: 100% 100%;
    opacity:0;
    border: 1px solid #1A0B1A;
}

#stage > div, #stage > button {
    position: absolute;
    margin: 0px;
    right: auto;
    bottom: auto;
    left: 0px;
    background-color: rgba(0, 0, 0, 0);
    background-size: 100% 100%;
    background-position: 0px 0px;
    background-repeat: no-repeat;
}


.hidden {
    display: none;
}

.scaled {
    width: 100%
}

#stage > div#grid {
    top: 75px;
    left: 0px;
    width: 855px;
    height: 528px;
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/grid.png);
}
#stage > div#header {
    top: 0px;
    width: 100%;
    height: 74px;
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/header.png);
}

#stage > button#tile, #stage > button.tile {
    left:517px;
    top: 303px;
    width: 338px;
    height: 299px;
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/album.png);
    cursor: zoom-in;
    border:none;
}

#stage div#nowPlaying {
    left: 105px;
    top: 549px;
    width: 642px;
    height: 55px;
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/nowPlaying.png);
    -webkit-box-shadow: 0px -3px 22px 5px rgba(0,0,0,0.27);
    -moz-box-shadow: 0px -3px 22px 5px rgba(0,0,0,0.27);
    box-shadow: 0px -3px 22px 5px rgba(0,0,0,0.27);
    border:none;
}

#details {
    top: 0px;
    left: 0px;
    width: 855px;
    height: 602px;
    overflow: hidden;
    cursor: zoom-out;
    display:none;
}

#details div.content {
    position: relative;
    width:855px;
    height:528px;
}

.content > div {
    position: absolute;
    margin: 0px;
    right: auto;
    bottom: auto;
    left: 0px;
    background-color: rgba(0, 0, 0, 0);
    background-size: 100% 100%;
    background-position: 0px 0px;
    background-repeat: no-repeat;
}

.content > #circle {
    left: 492px;
    top: 279px;
    width: 338px;
    height: 338px;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    background: #fec003;
}


.content > div#artist {
    opacity:0;
    left:-1px;
    top: 20px; 
    width: 857px;
    height: 586px;
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/pharrell.png );
    border:none;
}

.content > div#status {
    margin-top: -1px;
    opacity:0;
    left: 0px;
    top: 0px;
    width: 855px;
    height: 21px;
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/header_reveal.png);
    border:none;
}



#album {
    display: none;
    left:517px;
    top: 303px;
    width: 338px;
    height: 299px;
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/album.png);
}

.content > div#playlist {
    position: absolute;
    margin:0px;
    padding:0px;
    overflow: hidden;
    left:320px;
    top:315px;
    width:242px;
    height:243px;
    display: none;
}

.content > div#playlist > *{
    border: none;
}

.shadow {
    background-image: url(https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/nowPlaying.png);
    -webkit-box-shadow: 0px -3px 22px 5px rgba(0,0,0,0.27);
    -moz-box-shadow: 0px -3px 22px 5px rgba(0,0,0,0.27);
    box-shadow: 0px -3px 22px 5px rgba(0,0,0,0.27);
}

#playlist > img {
    margin-top: -1px;
    margin-left: -1px;
}



              
            
!

JS

              
                
    /**
     * Purpose:
     *
     * Use GSAP `TimelineLite` to demonstrate use of animation timelines to build complex transitions.
     * Use GSAP-AngularJS Timeline DSL to parse and build timeline transitions
     *
     */
    angular.module("gridReveal",['gsTimelines','ng'])
        .controller("RevealController", RevealController )
        .factory(   "catalog",          AlbumCatalog );

    /**
     * RevealController constructor
     * @constructor
     */
    function RevealController( $scope, catalog, $timeline, $timeout, $q, $log ) {

        $scope.catalog     = catalog;
        $scope.album       = catalog[0];
        $scope.showDetails = showDetails;
        $scope.hideDetails = hideDetails;

        enableAutoClose();

        // wait while reflow finishes
        wait( 1200 )
          .then( function() { return showDetails( $scope.album );})
          .then( function() { return wait( 300 );                })
          .then( hideDetails );

        // ************************************************************
        // Show Tile features
        // ************************************************************

        /**
         * Zoom the `#details` view simply by setting a $scope.state variable
         *
         */
        function showDetails( album ) {
            var request = promiseToNotify( "zoom", "complete." );

            $timeline( "zoom", {
                onUpdate          : makeNotify("zoom", "updating..."),
                onComplete        : request.notify
            });

            // Perform animation via state change
            $scope.state = "zoom";
            $scope.album = album;

            return request.promise;
        }

        /**
         *  Unzoom the `#details` view simply by clearing the state
         */
        function hideDetails() {
            $timeline( "zoom", {
                onUpdate          : makeNotify("zoom", "reversing..."),
                onReverseComplete : makeNotify("zoom", "reversed.")
            });

            $scope.state = '';
        }


        // ************************************************************
        // Other Features - autoClose and Scaling
        // ************************************************************

        function promiseToNotify(direction, action) {
            var deferred = $q.defer();

            return {
                promise : deferred.promise,
                notify  : function(tl){
                    $log.debug( "tl('{0}') {1}".supplant([direction, action || "finished"]));
                    deferred.resolve(tl);
                }
            };
        }
        /**
         * Reusable animation event callback for logging
         * @returns {Function}
         */
        function makeNotify (direction, action) {
            return function(tl) {
                $log.debug( "tl('{0}') {1}".supplant([direction, action || "finished"]));
            };
        }

        /**
         * Add Escape key and mousedown listeners to autoclose/reverse the
         * zoom animations...
         */
        function enableAutoClose() {
            $('body').keydown( autoClose );
            $('#mask').mousedown( autoClose );
            $('#details').mousedown( autoClose );
        }

        /**
         * Auto-close details view upon ESCAPE keydowns
         */
        function autoClose(e) {
            if ((e.keyCode == 27) || (e.type == "mousedown")) {
                ($scope.hideDetails || angular.noop)();
                e.preventDefault();
            }
        }

        /**
         * Simply utility function wait with a promise
         * @param delay
         * @returns {Deferred.promise|*}
         */
        function wait (delay, value) {
            var deferred = $q.defer();
            $timeout(function(){
                deferred.resolve( value || true );
            },delay,false);
            return deferred.promise;
        }

    }

    /**
     * Tile DataModel factory for model data used in Tile animations
     * @constructor
     *
     * CDN Prefix:     https://solutionoptimist-bucket.s3.amazonaws.com/kodaline
     * Local Prefix:   ./assets/images/koda
     */
    function AlbumCatalog() { 
        return [
            {
                className : "pharrell",
                aria : {
                    artist: "Pharrell Williams",
                    album : "GIRL"
                },
                from: {
                    left:517,
                    top: 303,
                    width: 338,
                    height: 299
                },
                to: {
                    left:106 ,
                    top:229,
                    width:641,
                    height:547
                },
                // Layout position when the album and playlist switch out
                switchOver : {
                    width:242,
                    height:243,
                    top:240,
                    left:320
                },
                playlist : "https://solutionoptimist-bucket.s3.amazonaws.com/kodaline/pharrell/playlist.png"
            }
        ];
    }


              
            
!
999px

Console