<section id="bold_turquoise_bear-4">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 100">
        <defs>
            <clipPath id="clip-1">
                <rect class="clip-1-rect" x="10" y="10" width="80" height="80" />
            </clipPath>

            <clipPath id="clip-2">
                <rect class="clip-2-rect" x="110" y="10" width="80" height="80" />
            </clipPath>

            <clipPath id="clip-3">
                <rect class="clip-3-rect" x="210" y="10" width="80" height="80" />
            </clipPath>
        </defs>

        <rect class="bg-rect" x="10" y="10" width="80" height="80" />
        <rect class="bg-rect" x="110" y="10" width="80" height="80" />
        <rect class="bg-rect" x="210" y="10" width="80" height="80" />

        <image clip-path="url(#clip-1)" href="/img/6404964189_8d2c7688c5_k.jpg" preserveAspectRatio="xMidYMid slice" x="0" y="0" width="300" height="100"></image>
        <image clip-path="url(#clip-2)" href="/img/22534825249_79ee4841af_k.jpg" preserveAspectRatio="xMidYMid slice" x="0" y="0" width="300" height="100"></image>
        <image clip-path="url(#clip-3)" href="/img/32242741015_6accbb5d52_k.jpg" preserveAspectRatio="xMidYMid slice" x="0" y="0" width="300" height="100"></image>
    </svg>
</section>

<script src="../../js/components/bold_turquoise_bear-4.js"></script>
<section id="bold_turquoise_bear-4">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 100">
        <defs>
            <clipPath id="clip-1">
                <rect class="clip-1-rect" x="10" y="10" width="80" height="80"/>
            </clipPath>

            <clipPath id="clip-2">
                <rect class="clip-2-rect" x="110" y="10" width="80" height="80"/>
            </clipPath>

            <clipPath id="clip-3">
                <rect class="clip-3-rect" x="210" y="10" width="80" height="80"/>
            </clipPath>
        </defs>

        <rect class="bg-rect" x="10" y="10" width="80" height="80"/>
        <rect class="bg-rect" x="110" y="10" width="80" height="80"/>
        <rect class="bg-rect" x="210" y="10" width="80" height="80"/>

        <image clip-path="url(#clip-1)" href="/img/6404964189_8d2c7688c5_k.jpg" preserveAspectRatio="xMidYMid slice" x="0" y="0" width="300" height="100"></image>
        <image clip-path="url(#clip-2)" href="/img/22534825249_79ee4841af_k.jpg" preserveAspectRatio="xMidYMid slice" x="0" y="0" width="300" height="100"></image>
        <image clip-path="url(#clip-3)" href="/img/32242741015_6accbb5d52_k.jpg" preserveAspectRatio="xMidYMid slice" x="0" y="0" width="300" height="100"></image>
    </svg>
</section>

<script src="{{ path '/js/components/bold_turquoise_bear-4.js' }}"></script>
/* No context defined. */
  • Content:
    (function () {
      document.addEventListener('DOMContentLoaded', function () {
        console.log("bold_turquoise_bear-4 active");
    
        window.setInterval(() => {
          document.querySelector("#bold_turquoise_bear-4").classList.toggle('active');
        }, 2000)
      });
    })();
    
  • URL: /components/raw/bold_turquoise_bear-4/bold_turquoise_bear-4.js
  • Filesystem Path: components/01-metal/04-working-with-clip-paths/04-bold_turquoise_bear-4/bold_turquoise_bear-4.js
  • Size: 266 Bytes
  • Content:
    #bold_turquoise_bear-4 {
      padding: 1rem;
    
      svg {
        border: 1px solid teal;
    
        .bg-rect {
          fill: coral;
        }
    
        // So the transform origin is the center of the clip path as it's absolutely
        // placed by the svg code...
    
        .clip-1-rect {
          transition: transform 2s ease;
          transform: scale(0.95, 0.05);
          transform-origin: 50px 50px;
        }
    
        .clip-2-rect {
          transition: transform 1s ease;
          transform-origin: 150px 50px;
        }
    
        .clip-3-rect {
          transition: transform 1s ease;
          transform: scale(0.5, 0.5);
          transform-origin: 250px 50px;
        }
      }
    
      // And we can transform from one scale to another easily enough, around the
      // transform origin we set above...
      &.active {
        svg {
          .clip-1-rect {
            transform: scale(0.05, 0.95);
          }
    
          .clip-2-rect {
            transform: scale(0.15, 0.75);
          }
    
          .clip-3-rect {
            transform: none;
          }
        }
      }
    }
    
  • URL: /components/raw/bold_turquoise_bear-4/bold_turquoise_bear-4.scss
  • Filesystem Path: components/01-metal/04-working-with-clip-paths/04-bold_turquoise_bear-4/bold_turquoise_bear-4.scss
  • Size: 947 Bytes
  • Handle: @bold_turquoise_bear-4
  • Preview:
  • Filesystem Path: components/01-metal/04-working-with-clip-paths/04-bold_turquoise_bear-4/bold_turquoise_bear-4.hbs

No notes defined.