実現したいこと
https://www.gorakadan.com/fuji/
上記URLのサイトのような、スクロールしたときの画像の現れ方を再現しようとしているのですが、つまずいています。
もやのようなものを再現するにはどうすればいいでしょうか?
発生している問題・分からないこと
画像を下から上に表示させることはできたのですが、
もやの再現方法が分かりません。
該当のソースコード
HTML
1<figure class="reveal-container"><img src="画像パス"></figure>
CSS
1.reveal-container { 2 position: relative; 3 overflow: hidden; 4} 5 6 7.reveal-container img { 8 width: 100%; 9 clip-path: inset(100% 0 0 0); 10 transition: clip-path 2s cubic-bezier(0.19,1,0.22,1); 11} 12 13 14.reveal-container::after { 15 content: ""; 16 position: absolute; 17 left: -10%; 18 bottom: -150px; 19 width: 120%; 20 height: 300px; 21 22 background: 23 radial-gradient(circle at 20% 60%, rgba(255,255,255,.8) 0%, transparent 60%), 24 radial-gradient(circle at 50% 40%, rgba(255,255,255,.7) 0%, transparent 60%), 25 radial-gradient(circle at 80% 60%, rgba(255,255,255,.8) 0%, transparent 60%); 26 27 filter: blur(20px); 28 opacity: .9; 29 30 transform: translateY(0); 31 transition: transform 2s cubic-bezier(0.19,1,0.22,1); 32 33 animation: steam 4s ease-in-out infinite; 34 pointer-events: none; 35 z-index: 2; 36} 37 38 39@keyframes steam { 40 0% { transform: translateY(0) translateX(0); } 41 50% { transform: translateY(-30px) translateX(20px); } 42 100% { transform: translateY(0) translateX(0); } 43} 44 45 46.reveal-container.is-animated img { 47 clip-path: inset(0 0 0 0); 48} 49 50.reveal-container.is-animated::after { 51 transform: translateY(-120%); 52}
JavaScript
1jQuery(function($) { 2 $(window).on('scroll load', function() { 3 $('.reveal-container').each(function() { 4 var targetPos = $(this).offset().top; 5 var scrollPos = $(window).scrollTop(); 6 var windowHeight = $(window).height(); 7 8 if (scrollPos > targetPos - windowHeight + (windowHeight * 0.2)) { 9 $(this).addClass('is-animated'); 10 } 11 }); 12 }); 13});
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
もやが再現しにくく動きも画像においつかない感じになってしまいます。
補足
特になし
回答1件
あなたの回答
tips
プレビュー
2026/01/23 01:13