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

              
                <section class="ui-container" id="ui-container">
    <div class="main-text work-content-text" id="Main-text">
      <h1>SaveCents</h1>
      <mat-chip-list class="mat-chip-list-wrapper" aria-label="Color selection">
        <mat-chip class="mat-chip" selected color="primary">
          AdobeXD
        </mat-chip>
        <mat-chip class="mat-chip" selected color="primary">
          Figma
        </mat-chip>
      </mat-chip-list>
      <div class="title">
        <p>A mock-up of a finance tracking app done with Figma</p>
      </div>
    </div>

    <div class="phone-container" id="phone-container">

      <div class="phone">
        <div class="title ">
          <!-- <span >Hi-fi of Money Talks</span> -->
          <!-- <span class="d-flex align-items-center justify-content-center">Full App</span> -->
        </div>
        <div class="containers">
          <div class="pt-5 px-2 d-flex flex-row justify-content-between">
            <i class="fas fa-arrow-left nav-icon"></i>
            <i class="far fa-bell nav-icon position-relative">
                <div class="dot position-absolute"></div>
            </i>
        </div>

        <div class="text-center mt-4">
            <span class="heading">Statistics</span>
        </div>

        <div class="text-center">
            <span class="sub-heading">See your money in real time</span>
        </div>

        <div class="d-flex flex-row menu mt-5 mx-2 justify-content-between align-items-center">
            <span class="px-4 py-2 active current">Expenses</span>
            <span class="px-4 py-2 active " >Income</span>
            <span class="px-4 py-2 active ">Savings</span>
        </div>

        <div class="d-flex flex-row mt-3 mx-2 menu2 align-items-center">
            <span class="filter px-3 py-3 mr-2" >Daily</span>
            <span class="filter px-3 py-3 mr-2 filter-active">Weekly</span>
            <span class="add-filter px-3 py-3">
                <i class="fas fa-plus filter-icon"></i>
                Add Filter</span>
        </div>

        <div class="d-flex flex-column chart-bg mx-2 mt-3">
            <div class="d-flex flex-row justify-content-between align-items-center p-4">
                <span class="expense-label col-2">Weekly Expenses</span>
                <span class="expense" id="Number">$0</span>
            </div>
            <div class="d-flex flex-row justify-content-between align-items-end p-4" style="height:250px;">
                <div class="d-flex flex-column align-items-center">
                    <div class="position-relative">
                        <div class="bar-1 position-absolute" style="height: 170px;"></div>
                        <div class="bar-2" style="height: 200px;"></div>
                    </div>
                    <span class="chart-label mt-3">Mon</span>
                </div>
                <div class="d-flex flex-column align-items-center">
                    <div class="position-relative">
                        <div class="bar-1 position-absolute" style="height: 110px;"></div>
                        <div class="bar-2" style="height: 140px;"></div>
                    </div>
                    <span class="chart-label mt-3">Tue</span>
                </div>
                <div class="d-flex flex-column align-items-center">
                    <div class="position-relative">
                        <div class="bar-1 position-absolute" style="height: 60px;"></div>
                        <div class="bar-2" style="height: 90px;"></div>
                    </div>
                    <span class="chart-label mt-3">Wed</span>
                </div>
                <div class="d-flex flex-column align-items-center">
                    <div class="position-relative">
                        <div class="bar-1 position-absolute" style="height: 30px;"></div>
                        <div class="bar-2" style="height: 60px;"></div>
                    </div>
                    <span class="chart-label mt-3">Thu</span>
                </div>
                <div class="d-flex flex-column align-items-center">
                    <div class="position-relative">
                        <div class="bar-1 position-absolute" style="height: 100px;"></div>
                        <div class="bar-2" style="height: 130px;"></div>
                    </div>
                    <span class="chart-label mt-3">Fri</span>
                </div>
                <div class="d-flex flex-column align-items-center">
                    <div class="position-relative">
                        <div class="bar-1 position-absolute" style="height: 40px;"></div>
                        <div class="bar-2" style="height: 70px;"></div>
                    </div>
                    <span class="chart-label mt-3">Sat</span>
                </div>
                <div class="d-flex flex-column align-items-center">
                    <div class="position-relative">
                        <div class="bar-1 position-absolute" style="height: 60px;"></div>
                        <div class="bar-2" style="height: 90px;"></div>
                    </div>
                    <span class="chart-label mt-3">Sun</span>
                </div>

            </div>
        </div>
      </div>
    </div>

    <div class="endTrigger"></div>
    </div>
  </section>
              
            
!

CSS

              
                  :root{
  --fs-nav-logo: calc(var(--fs-nav-a) + 30px);
  --fs-nav-a: 20px;
  --fs-large: 50px;
  --fs-big: 1.3rem;
  --fs-p:1.3rem;
  --fs-loading:12rem;
  --fs-span:1.5rem;
  --fs-h1:5.5rem;
  --fs-h2: 4rem;
  --fs-h3: 35px;
  --fs-btn:1.8rem;

  //*Hero Section
  --top-h2-ml: 4.1vw;
  --bottom-h2-mr: 6vw;
  --top-h2-mt: 15vh;
  --bottom-h2-mb: 30vh;
  --bottom-h2-mt: 5vh;
  --fs-home-p: 2rem;
  --fs-home-main: 11.3vw;
  --main-h1-top: 50%;
  --bottom-h1-top: -50%;
  --fs-small:1.2rem;

  //* Margin
  --mb:15px;
  --mt:5rem;

  //*Padding
  --card-padding: 35px 45px;
  --header-padding: 25px 4%;
  --section-padding: 50px 4% 40px;
  --section-padding-left: 4%;

  //* Line height
  --line-height:1.2;

  //*Font-weight
  --fw-bold:bold;

  //* Work image width
  --work-img-width:530px;

  //*Gap
  --gap : 10rem;

  //* Phone scale
  --scale:.7;

  // * Css Phone margin top
  --phone-mt: -20px;

  //* Image transform
  --transform-img1: translate(-15px,-100px) rotate(-2deg);

  --transform-img2: translate(-15px, 140px) rotate(6deg);
    
   --work-grid: repeat( auto-fit, minmax(250px, 1fr) );

  }
section:not(.home, .end){
  padding: var(--section-padding);
  background-color:black;
}

.ui-container{
  color: white;
  display: grid;
  place-content: center;
  grid-template-columns: var(--work-grid);
  gap: var(--gap);
  padding-bottom: 50px;
  height: 100%;
  // background-color: red;
}

.main-text{
  font-size: var(--fs-p);
  // order: var(--work-img-order);
}

.phone{
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  will-change: transform;
  transform: translate3d(0px, 0px, 0px) scale3d(1, 1, 1) rotateX(20deg) rotateY(-35deg) rotateZ(25deg) skew(0deg, 0deg) scale(var(--scale));
  // transform: scale(var(--scale));
  transform-style: preserve-3d;
  transition: .5s ease-in-out;
  // Swap order
  order: var(--work-text-order);

  // overflow: hidden;
}

.containers {
  width: 370px;
  height: 690px;
  // height: 605px;
  background: #1c253f;
  border-radius: 19px;
  margin-top: 0px;
  left: 0;
  box-shadow: none;
}

.title {
  font-size: calc(var(--fs-p));
  height: 45px;
  p:nth-child(2) {
    position: relative;
    left: 0;
  }
}

i.nav-icon {
  color: #585f8b;
  font-size: 1.5em;
  cursor: pointer;
}

span.heading {
  font-size: 2em;
  color: #fff0ff;
  font-weight: 900;
  letter-spacing: 2px;
}

span.sub-heading {
  color: #585f8b;
  font-weight: 700;
  font-size: 0.8em;
  letter-spacing: 1px;
}

div.menu {
  transform: translate(-15%, 0%);
  background: #162037;
  color: #585f8b;
  border-radius: 10px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 10px 0px 20px 10px rgba(0, 0, 0, 0.222);
}

.menu {
  // * X Height
  transform: translate(-40%, 0%);
  box-shadow: 10px 0px 20px 10px rgba(0, 0, 0, 0.222);
}

.menu2 {
  // * X Height
  transform: translate(-30%, 0%);
  box-shadow: 10px 0px 20px 10px rgba(0, 0, 0, 0.222);
}

.chart-bg {
  // * X Height
  transform: translate(-20%, 0%);
  box-shadow: 10px 0px 20px 10px rgba(0, 0, 0, 0.222);
}

.current {
  margin: 5px;
  border-radius: 10px;
  background: linear-gradient(to right, #ce2eff, #a02ff6);
  color: #fff0ff;
}

.active {
  margin: 5px;
  border-radius: 10px;

  &:hover {
    transition: all 0.1s ease-in;
    background: linear-gradient(to right, #ce2eff, #a02ff6);
    color: #fff0ff;
  }
}

span.filter {
  border-radius: 10px;
  background: #162037;
  color: #585f8b;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
}

span.add-filter {
  background: #162037;
  border-radius: 10px;
  color: #585f8b;
  border: 1px solid #585f8b;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
}

i.filter-icon {
  font-size: 10px;
}

span.filter-active {
  color: #fff0ff;
  &:hover {
    color: #fff0ff;
  }
}

span.expense-label {
  color: #fff0ff;
  position: relative;
  z-index: 0;
}

span.expense-label::before {
  content: "";
  position: absolute;
  background: #4d2472;
  width: 64px;
  height: 9px;
  top: 38px;
  left: 4px;
  z-index: -1;
}

span.expense {
  color: #fff0ff;
  font-weight: 900;
  letter-spacing: 3px;
  font-size: 34px;
}

div.bar-1 {
  bottom: 0;
  width: 20px;
  border-radius: 5px;
  background: linear-gradient(to bottom, #ff91c2, #fe59fd);
}

div.bar-2 {
  width: 20px;
  background: #2a3350;
  border-radius: 5px;
}

span.chart-label {
  font-size: 10px;
  font-weight: 900;
  color: #585f8b;
}

.chart-bg {
  background: #162037;
  border-radius: 25px;
}

.load-container {
  display: flex;
  justify-content: center;
  align-items: center;
  h2 {
    font-size: var(--fs-h2);
    color: var(--color-text);
  }
}

              
            
!

JS

              
                 

let tl = gsap.timeline({paused:true,})
        tl
        //* Phone animation
        //* Charts
        .to('.chart-bg, .menu, .menu2',{transform:'translate(0%, 0%)', stagger:.3, boxShadow:'none', scrollTrigger:{
          trigger:'.chart-bg',
          scrub:true,
          start:'clamp(top 40%)',
          end:'clamp(bottom -35%)',
        }},'-=1')

        //* Rotate phone
        .to('.phone',{rotateX:'0deg', rotateY:'0deg', rotateZ:'0deg', scrollTrigger:{
          trigger:'.phone',
          scrub:true,
          start:'clamp(top 10%)',
          end:'clamp(bottom -35%)',
          pinSpacing:false,
        }},'<')

        //* Add box shadow to phone
        .to('.containers',{boxShadow:' 0 0 30px 15px rgba(255, 255, 255, 0.138)', scrollTrigger:{
          trigger:'.phone',
          scrub:true,
          start:'clamp(top 20%)',
          end:'clamp(bottom -40%)',
          pinSpacing:false,
        }})

        //* Control height of bars
        .from('.bar-1 , .bar-2',{height:'0' , scrollTrigger:{
          trigger:'.phone',
          scrub:true,
          start:'clamp(top 20%)',
          end:'clamp(bottom -40%)',
          pinSpacing:false,
        }})

        ScrollTrigger.saveStyles('#Main-text, .phone-container')
ScrollTrigger.matchMedia({
      // large
      "(min-width: 960px)": () => {
        console.log('A');

        // * Control length of whole animation
        const t2 = gsap.timeline()
        ScrollTrigger.create({
          trigger:'#Main-text',
          endTrigger:'.endTrigger',
          scrub:1,
          pin:'#Main-text',
          start:'top 35%',
          end:'-=45%',
          markers:true,
          invalidateOnRefresh:true,
        })

        ScrollTrigger.create({
          trigger:'.phone-container',
          endTrigger:'.endTrigger',
          scrub:1,
          pin:'.phone-container',
          start:'top 15%',
          end:'bottom 8%',
          pinSpacing:false,
          markers:true,
          invalidateOnRefresh:true,
        })
        // t2
        // gsap.to('#main-text',{scrollTrigger:{
        //   trigger:'#Main-text',
        //   endTrigger:'.endTrigger',
        //   scrub:1,
        //   pin:'#Main-text',
        //   start:'top 35%',
        //   end:'-=45%',
        //   markers:true,
        //   invalidateOnRefresh:true,
        // }})

        // gsap.to('.phone-container',{ scrollTrigger:{
        //   trigger:'.phone-container',
        //   endTrigger:'.endTrigger',
        //   scrub:1,
        //   pin:'.phone-container',
        //   start:'top 15%',
        //   end:'bottom 8%',
        //   pinSpacing:false,
        //   markers:true,
        //   invalidateOnRefresh:true,
        // }})

        t2.scrollTrigger.refresh();
      },

      // medium
      "(min-width: 600px) and (max-width: 959px)": function() {
      },

      // small
      "(max-width: 599px)": function() {
      },

      // all
      "all": function() {
        // *Make the numbers increase on scroll
        let tl = gsap.timeline()
        tl.to(num,{var: 330, duration:5, ease:'none', onUpdate:changeNumber, scrollTrigger:{
          trigger:'.phone',
          start:'top 20%',
          end: 'clamp(bottom -40%)',
          pinSpacing:false,
          scrub:1,
          invalidateOnRefresh:true,
        }})
      }
    });

    ScrollTrigger.refresh();
}
              
            
!
999px

Console