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

              
                <h2>Click the message bubble ⬇️</h2>
<svg id="laptopSVG" viewBox="0 0 1028 664">
    <mask id="mask">
<rect x="290" y="287" width="455" height="256" style="fill:#fff;"/>
  </mask>
    <g id="design">
        <path id="message" class="clickable" d="M561,79.99l0,96.02c0,4.962 4.033,8.99 9.006,8.99l15.916,0l12.422,13l12.422,-13l107.228,0c4.979,0 9.006,-4.023 9.006,-8.99l0,-96.02c0,-4.962 -4.033,-8.99 -9.006,-8.99l-147.988,0c-4.979,0 -9.006,4.023 -9.006,8.99Z" style="fill:#d8d8d8;fill-rule:nonzero;"/>
        <g id="whatsapp" class="clickable">
            <path id="whatsapp__phone" d="M930.043,427.97c-1.92,-0.968 -11.355,-5.648 -13.114,-6.294c-1.759,-0.646 -3.038,-0.968 -4.318,0.968c-1.279,1.936 -4.957,6.295 -6.076,7.586c-1.12,1.291 -2.239,1.453 -4.158,0.484c-1.919,-0.968 -8.103,-3.011 -15.433,-9.603c-5.705,-5.13 -9.557,-11.465 -10.676,-13.402c-1.119,-1.937 -0.119,-2.984 0.841,-3.948c0.864,-0.867 1.92,-2.26 2.879,-3.39c0.96,-1.129 1.279,-1.937 1.919,-3.227c0.64,-1.292 0.32,-2.421 -0.16,-3.39c-0.48,-0.968 -4.318,-10.491 -5.917,-14.365c-1.557,-3.772 -3.14,-3.261 -4.318,-3.321c-1.118,-0.056 -2.399,-0.068 -3.678,-0.068c-1.279,0 -3.358,0.484 -5.117,2.421c-1.759,1.936 -6.717,6.617 -6.717,16.139c0,9.524 6.876,18.723 7.836,20.014c0.96,1.292 13.532,20.833 32.784,29.213c4.578,1.993 8.153,3.184 10.94,4.075c4.597,1.473 8.781,1.265 12.088,0.767c3.687,-0.555 11.354,-4.68 12.953,-9.199c1.599,-4.52 1.599,-8.393 1.119,-9.2c-0.479,-0.807 -1.758,-1.291 -3.677,-2.26" style="fill:#e64;fill-rule:nonzero;"/>
            <path id="whatsapp__bubble" d="M895.322,474.697l-0.026,0c-11.436,-0.005 -22.652,-3.082 -32.437,-8.899l-2.328,-1.383l-24.121,6.338l6.438,-23.558l-1.515,-2.415c-6.379,-10.164 -9.749,-21.911 -9.744,-33.974c0.014,-35.198 28.604,-63.834 63.758,-63.834c17.023,0.006 33.025,6.655 45.058,18.722c12.032,12.067 18.655,28.106 18.648,45.164c-0.014,35.2 -28.604,63.839 -63.731,63.839Zm-0.001,-140.697c-42.264,0 -76.661,34.453 -76.678,76.801c-0.006,13.537 3.525,26.75 10.235,38.399l-10.878,39.8l40.648,-10.68c11.2,6.118 23.81,9.344 36.643,9.348c42.291,0 76.692,-34.457 76.709,-76.805c0.008,-20.523 -7.961,-39.82 -22.437,-54.338c-14.477,-14.518 -33.729,-22.517 -54.242,-22.525Z" style="fill:#d8d8d8;fill-rule:nonzero;"/>
        </g>
        <g id="clock" class="clickable">
            <circle id="clock__background" cx="272" cy="215" r="80" style="fill:#fff;stroke:#d8d8d8;stroke-width:14px;"/>
<path id="clock__minute" d="M272.406,150.902C273.724,151.009 274.084,151.148 274.776,151.424C277.291,152.426 279.162,154.874 279.456,157.58C279.495,157.939 279.49,158.03 279.5,158.391L279.5,214.01C279.343,219.82 271.432,223.803 266.842,219.455C265.562,218.243 264.734,216.57 264.544,214.821C264.505,214.462 264.51,214.371 264.5,214.01L264.5,158.391C264.541,156.894 264.702,156.444 265.033,155.615C266.035,153.1 268.483,151.229 271.189,150.935C271.972,150.85 272.156,150.895 272.406,150.902Z" style="fill:rgb(216,216,216);fill-rule:nonzero;"/>
            <path id="clock__hour" d="M272.406,170.902C273.724,171.009 274.084,171.148 274.776,171.424C274.865,171.459 274.952,171.496 275.039,171.535C277.421,172.598 279.172,174.969 279.456,177.58C279.495,177.939 279.49,178.03 279.5,178.391L279.5,214.01C279.343,219.82 271.432,223.803 266.842,219.455C265.562,218.243 264.734,216.57 264.544,214.821C264.505,214.462 264.51,214.371 264.5,214.01L264.5,178.391C264.541,176.894 264.702,176.444 265.033,175.615C266.035,173.1 268.483,171.229 271.189,170.935C271.972,170.85 272.156,170.895 272.406,170.902Z" style="fill:rgb(238,102,68);fill-rule:nonzero;"/>
        </g>
        <g id="laptop">
            <g id="laptop__base">
                <path id="Shape" d="M218,574l600,0l0,10c0,5.523 -4.485,10 -10.007,10l-579.986,0c-5.527,0 -10.007,-4.476 -10.007,-10l0,-10Z" style="fill:#344;fill-rule:nonzero;"/>
                <path id="Shape1" serif:id="Shape" d="M459,574l118,0l0,3c0,1.657 -1.346,3 -3.006,3l-111.988,0c-1.66,0 -3.006,-1.347 -3.006,-3l0,-3Z" style="fill:#495959;fill-rule:nonzero;"/>
            </g>
            <g id="laptop__screen">
                <path id="laptop__screen__bezel" d="M260,267c0,-5.523 4.472,-10 9.999,-10l495.002,0c5.522,0 9.999,4.481 9.999,10l0,307l-515,0l0,-307Z" style="fill:#515e5e;fill-rule:nonzero;"/>
                <rect id="laptop__screen__screen" x="290" y="287" width="455" height="256" style="fill:#fff;"/>
                <circle id="laptop__screen__webcam" cx="523" cy="273" r="3" style="fill:#344;"/>
            </g>
        </g>
        <g mask="url(#mask)">
        <g id="notification__first" class="notification clickable">
  <path id="notification__background1" serif:id="notification__background" d="M728,310c0,-2.76 -2.24,-5 -5,-5l-223,0c-2.76,0 -5,2.24 -5,5l0,48c0,2.76 2.24,5 5,5l223,0c2.76,0 5,-2.24 5,-5l0,-48Z" style="fill:#d8d8d8;" />
  <path id="notification__icon1" serif:id="notification__icon" d="M543.028,321.6c0,-2.76 -2.24,-5 -5,-5l-25,0c-2.76,0 -5,2.24 -5,5l0,25c0,2.76 2.24,5 5,5l25,0c2.76,0 5,-2.24 5,-5l0,-25Z" style="fill:#e64;" />
  <path id="notification__text" d="M559.177,329.047c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.174 1.696,-3.937 3.789,-3.937l35.447,0c2.093,0 3.79,1.763 3.79,3.937c0,2.175 -1.697,3.938 -3.79,3.938l-35.447,0Zm53.17,0c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.174 1.696,-3.937 3.789,-3.937l99.251,0c2.093,0 3.79,1.763 3.79,3.937c0,2.175 -1.697,3.938 -3.79,3.938l-99.251,0Zm-53.17,20.125c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.175 1.696,-3.938 3.789,-3.938l100.264,0c2.093,0 3.789,1.763 3.789,3.938c0,2.175 -1.696,3.938 -3.789,3.938l-100.264,0Z"
    style="fill:#c5c5c5;fill-rule:nonzero;" />
</g>
<g id="notification__second" class="notification clickable">
  <path id="notification__background" d="M728,378c0,-2.76 -2.24,-5 -5,-5l-223,0c-2.76,0 -5,2.24 -5,5l0,48c0,2.76 2.24,5 5,5l223,0c2.76,0 5,-2.24 5,-5l0,-48Z" style="fill:#d8d8d8;" />
  <path id="notification__icon" d="M543.028,389.6c0,-2.76 -2.24,-5 -5,-5l-25,0c-2.76,0 -5,2.24 -5,5l0,25c0,2.76 2.24,5 5,5l25,0c2.76,0 5,-2.24 5,-5l0,-25Z" style="fill:#e64;" />
  <path id="notification__second__text" d="M559.797,397.047c-2.093,0 -3.79,-1.763 -3.79,-3.938c0,-2.174 1.697,-3.937 3.79,-3.937l151.801,0c2.093,0 3.79,1.763 3.79,3.937c0,2.175 -1.697,3.938 -3.79,3.938l-151.801,0Zm-0.62,20.125c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.175 1.696,-3.938 3.789,-3.938l100.264,0c2.093,0 3.789,1.763 3.789,3.938c0,2.175 -1.696,3.938 -3.789,3.938l-100.264,0Z"
    style="fill:#c5c5c5;fill-rule:nonzero;" />
</g>

</g>
        <g id="mail">
            <path id="mail__background" d="M205,428.427c0,-3.002 2.442,-5.427 5.444,-5.427l122.112,0c3.002,0 5.444,2.43 5.444,5.427l0,94.146c0,3.002 -2.442,5.427 -5.444,5.427l-122.112,0c-3.002,0 -5.444,-2.43 -5.444,-5.427l0,-94.146Z" style="fill:#d8d8d8;fill-rule:nonzero;"/>
            <path id="mail__shadow" d="M215.249,513.798l53.445,-37.579c2.133,-1.5 5.143,-1.492 7.266,0.018l52.841,37.579c4.322,3.074 1.884,9.283 -3.646,9.283l-106.286,0c-5.546,0 -7.974,-6.24 -3.62,-9.301Z" style="fill:#c5c5c5;fill-rule:nonzero;"/>
            <path id="mail__lip" d="M324.519,431.065c1.734,-1.338 4.255,-1.055 5.631,0.632c1.375,1.688 1.085,4.141 -0.65,5.479l-54.678,42.2c-1.453,1.121 -3.506,1.127 -4.964,0.014l-55.305,-42.2c-1.742,-1.329 -2.047,-3.781 -0.681,-5.476c1.366,-1.695 3.885,-1.991 5.627,-0.662l52.818,40.302l52.202,-40.289Z" style="fill:#515e5e;fill-rule:nonzero;"/>
        </g>
        <g id="label" class="clickable">
            <path id="label__background" d="M762,311c-21.539,0 -39,-17.461 -39,-39c0,-21.539 17.461,-39 39,-39c21.539,0 39,17.461 39,39c0,21.539 -17.461,39 -39,39Z" style="fill:#fff;fill-rule:nonzero;"/>
            <circle id="label__alert" cx="762.5" cy="272.5" r="31.5" style="fill:#e64;"/>
        </g>
    </g>
</svg>


              
            
!

CSS

              
                
#mail,
.notification,
#message,
#clock,
#whatsapp,
#label {
  visibility: hidden;
}

.clickable {
  cursor: pointer;
}
h1 {
  text-align: center;
}
              
            
!

JS

              
                //--------------------------------//
// Laptop Animation
//--------------------------------//
document.querySelectorAll("#laptopSVG").forEach(function (container) {
  // Base ease full timeline
  // TweenLite.defaultEase = Back.easeOut.config(1.1);
  const baseAnimate = 0.3;
  const q = gsap.utils.selector(container);
  let loop = gsap.timeline({
    paused: true,
    repeat: -1,
    repeatDelay: 1.5
  });
  const tlMain = gsap.timeline({
    // scrollTrigger: {
    //   trigger: container, // What element triggers the scroll
    //   start: "top bottom-=10%", // Can be top, center, bottom 
    //   // end: "100% center", // Can be top, center, bottom 
    //   endTrigger: "html",
    // }
  });
  
    loop.fromTo(q('#message'), {autoAlpha: 0, rotation: 180, transformOrigin: "bottom left"}, {
      duration: baseAnimate * 2,
      autoAlpha: 1,
      rotation: 0,
      transformOrigin: "bottom left",
      ease: "back.out(1.1)",
    });
    loop.fromTo(q('#mail'), {autoAlpha: 0, y: 200}, {
      duration: baseAnimate * 2,
      autoAlpha: 1,
      y: 0,
      ease: "back.out(1.1)",
    })
    loop.to(q('#message'), {
      duration: baseAnimate * 2,
      rotation: -180,
      autoAlpha: 0,
      ease: "back.in(1.1)",
      transformOrigin: "bottom left"
    }, "+=5");
    loop.to(q('#mail'), {
      duration: baseAnimate * 2,
      y: -200,
      autoAlpha: 0,
      ease: "back.in(1.1)",
    });

  //------------------------------------------------------//
  // END Nested animations
  //------------------------------------------------------//

  tlMain.from('#laptop__screen', {
    duration: baseAnimate * 2,
    scaleY: 0,
    transformOrigin: "bottom center",
    ease: "back.out(1.1)"
  })
  // Message & Mail loop
  tlMain.add(() => loop.play(), "+=1")
  // Notification loops
  
  // Interactive elments 
  container.querySelectorAll(".clickable").forEach(function (clickable) {

    clickable.addEventListener('click', () => {
      loop.pause();
      gsap.to(clickable, {
        scale: 0,
        duration: 0.2,
        transformOrigin: "center center",
        onComplete: () => {
          gsap.set(clickable, {scale: 1, autoAlpha: 0, transformOrigin: "bottom left"})
          gsap.delayedCall(2, () => loop.restart());
        }
      });
    })

  });

});


// END Laptop --------------//


              
            
!
999px

Console