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="flex fw">
  <p>section01</p>
</section>


<section id="indexWork">
<div class="workWrap">
        <div id="work01" class="workBox">
            <div class="workBoxIn flex">
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                 <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article> 
            </div>
        </div>

        <div id="work02" class="workBox">
            <div class="workBoxIn flex">
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                 <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article> 
            </div>
        </div>
        
        <div id="work03" class="workBox">
            <div class="workBoxIn flex">
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                 <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/fk4VwQ6Z/02.jpg" alt="">
                    </picture>
                </article>
                <article>
                    <picture>
                        <source>
                        <img src="https://i.postimg.cc/pdNMqXKP/05.jpg" alt="">
                    </picture>
                </article> 
            </div>
        </div>
    </div>
  </section>

<section class="flex fw">
  <p>section02</p>
</section>

<section class="flex fw">
  <p>section03</p>
</section>
              
            
!

CSS

              
                @charset "utf-8";
$siteColor: #101112;
$black: #000;
$white: #fff;

$fontAwesome: font awesome 6 Pro;
$gothic: "游ゴシック体",YuGothic,"游ゴシック","Yu Gothic","メイリオ",sans-serif;
$serif: source-han-serif-japanese, serif;
$english: garamond-premier-pro-display, serif;

body {
	background-color: $siteColor;
	position: relative;
  color: $white;
}

.flex {
	display: -webkit-flex;
	display: -moz-flex;
	display: -ms-flex;
	display: -o-flex;
	display: flex;
}

.fw {
	flex-wrap: wrap;
}

img {
	display: block;
	width: 100%;
}

section {
  position: relative;
  z-index: 20;
  padding: 6em 0;
  height: 100vh;
  &.flex {
    justify-content: center;
    align-items: center
  }
  > p {
    text-align: center;
  }
}

#indexWork {
  padding: 0;
}
.workWrap {
        background-color: rgba($black,.6);
        width: 100%;
        height: 100vh;
        overflow: hidden;
        .workBox {
            transform: rotate(20deg);
            transform-origin: left;
            width: 400%;
            transition: all 1.5s ease-out;
            &#work01 {
                margin: -80vh 0 0 0;
            }
            &#work01,&#work02,&#work03 {
                position: relative;
                .workBoxIn {
                }
            }
            .workBoxIn {
                position: relative;
                article {
                    width: 20%;
                    padding: 3vw 2vw;
                    picture {
                        display: block;
                        overflow: hidden;
                        width: 100%;
                        aspect-ratio: 4 / 1.8;
                        img {
                            max-width: 110%;
                            width: 110%;
                            position: relative;
                            transition: all 1.5s ease-in-out;
                        }
                    }
                }
            }
   }
}
              
            
!

JS

              
                document.addEventListener('DOMContentLoaded', function() {
  const w1 = document.getElementById('work01');
  const w2 = document.getElementById('work02');
  const w3 = document.getElementById('work03');
  const tangent = Math.tan(20 * Math.PI / 180);
  const speed = .3;  // スライド速度 (スクロール量に対するスライド量の比率)

  const imgs1 = w1.getElementsByTagName('img');
  const imgs2 = w2.getElementsByTagName('img');
  const imgs3 = w3.getElementsByTagName('img');
  const prlx_vol = 50;  // パララックスで画像が動く量の調節。値が低いほどよく動く。50以上推奨

  window.addEventListener("scroll", function () {

    let scr_start = document.getElementsByClassName('workWrap')[0].getBoundingClientRect().top + window.pageYOffset - window.innerHeight; // 画面上端からworkWrapまでの距離
    let slide = (window.scrollY - scr_start) * speed;
    let prlx_rate = slide / prlx_vol;
    let img_w = document.getElementsByClassName('workBoxIn')[0].getElementsByTagName('article')[0].offsetWidth;
    let offset = img_w * 3;  // 画像N枚分あらかじめ左寄せ

    if (slide > 0 && scr_start > 0) {
      w1.style.left = (slide - offset) + 'px';
      w1.style.top = (slide - offset) * tangent + 'px';
      w2.style.left = -(slide) + 'px';
      w2.style.top = -(slide) * tangent + 'px';
      w3.style.left = (slide - offset) + 'px';
      w3.style.top = (slide - offset) * tangent + 'px';
    }

    // パララックス
    if (prlx_rate > 0 && prlx_rate < 10) {
      for (let i = 0; i < imgs1.length; i++) {
        imgs1[i].style.left = - prlx_rate + '%';
        imgs2[i].style.left = prlx_rate - 10 + '%';
        imgs3[i].style.left = - prlx_rate + '%';
      }
    }
  });
});
              
            
!
999px

Console