検索
ホームページウェブフロントエンドhtmlチュートリアルクリスマス向けに CSS3 だけで実装した雪だるまアニメーションの特殊効果 2014_html/css_WEB-ITnose

2014 年のクリスマスに、iProgramming の編集者は、純粋な CSS3 で実現された雪だるまアニメーションの特殊効果を共有しました。この例では、雪だるまがジャンプする特殊効果を実装しています。レンダリングは次のとおりです。

オンライン プレビュー ソース コードのダウンロード

実装されたコード。

html コード:

 <span class="text">lolwut<small>-@rsmswlln</small></span>    <div class="body">        <div class="hat">            <div class="ribbon">            </div>        </div>        <div class="face">        </div>        <div class="scarf">        </div>        <div class="right-arm">            <div class="hand">            </div>        </div>        <div class="left-arm">            <div class="hand">            </div>        </div>    </div>    <div class="puddle">    </div>

css コード:

 body {  background: #c0392b;}.body {  width: 250px;  height: 250px;  background: #ffffff;  border-radius: 50%;  box-shadow: inset -20px -5px 35px rgba(0, 0, 0, 0.2);  position: absolute;  right: 0;  left: 0;  margin: 300px auto;  animation: jump 1s infinite;}.body:before {  z-index: 2;  content: "";  width: 180px;  height: 180px;  background: #ffffff;  border-radius: 50%;  box-shadow: inset -10px -5px 10px rgba(0, 0, 0, 0.2);  position: relative;  display: inline-block;  top: -120px;  left: 25px;}.body:after {  content: "";  width: 140px;  height: 140px;  background: #ffffff;  border-radius: 50%;  box-shadow: inset -10px -5px 10px rgba(0, 0, 0, 0.2);  position: relative;  display: inline-block;  top: -400px;  left: 20px;}.body > .hat {  width: 200px;  height: 15px;  border-radius: 50%;  background-color: #111111;  position: absolute;  z-index: 4;  top: -200px;  left: -15px;}.body > .hat:before {  content: "";  width: 100px;  height: 65px;  background-color: #111111;  display: inline-block;  position: relative;  top: -55px;  left: 51px;}.body > .hat:after {  z-index: 5;  content: "";  display: inline-block;  position: relative;  top: -145px;  left: 51px;  width: 100px;  height: 5px;  border-radius: 50%;  background-color: #2b2b2b;}.body > .hat > .ribbon {  height: 10px;  width: 100px;  background-color: #6d2018;  position: relative;  top: -90px;  left: 51px;  z-index: 6;}.body > .face {  z-index: 3;  width: 12px;  height: 12px;  background-color: #2c3e50;  border-radius: 50%;  position: absolute;  top: -170px;  left: 38px;}.body > .face:before {  content: "";  background-color: transparent;  display: inline-block;  position: relative;  top: 30px;  left: -45px;  transform: rotate(-15deg);  border-top: 12px solid transparent;  border-bottom: 12px solid transparent;  border-right: 40px solid #e67e22;}.body > .face:after {  content: "";  background-color: transparent;  display: inline-block;  position: relative;  top: 0;  left: -46px;  transform: rotate(-15deg);  border-top: 12px solid transparent;  border-right: 40px solid #bf6516;}.body > .scarf {  z-index: 3;  width: 150px;  height: 30px;  background-color: #2980b9;  position: absolute;  top: -110px;  left: 25px;  transform: rotate(-15deg);  border-radius: 20%;}.body > .scarf:after {  content: "";  width: 75px;  height: 30px;  background-color: #2980b9;  display: inline-block;  position: relative;  top: 16px;  left: 80px;  transform: rotate(85deg);  border-radius: 20%;}.body > .left-arm,.body .right-arm {  z-index: 7;  width: 100px;  height: 6px;  background-color: #825a2c;  position: absolute;  top: 10px;  left: -20px;  transform: rotate(-15deg);  animation: rub-right 0.5s infinite;}.body > .left-arm > .hand,.body .right-arm > .hand {  width: 25px;  height: 6px;  background-color: #825a2c;  position: absolute;  top: -32px;  left: -60px;  transform: rotate(75deg);}.body > .left-arm:after,.body .right-arm:after {  content: "";  width: 75px;  height: 6px;  background-color: #a87439;  display: inline-block;  position: relative;  top: -24px;  left: -70px;  transform: rotate(25deg);}.body > .left-arm.left-arm,.body .right-arm.left-arm {  background-color: #a87439;  animation: rub-left 0.5s infinite;  top: -15px;  z-index: 1;}.body > .left-arm.left-arm > .hand,.body .right-arm.left-arm > .hand {  background-color: #a87439;  top: -14px;  transform: rotate(45deg);}.body > .left-arm.left-arm:after,.body .right-arm.left-arm:after {  background-color: #825a2c;  transform: rotate(5deg);  top: -12px;  left: -74px;}.puddle {  z-index: -1;  width: 200px;  height: 100px;  background: #2980b9;  border-radius: 50%;  position: absolute;  right: 0;  left: -50px;  margin: 500px auto;}.puddle:after {  content: "";  width: 120px;  height: 80px;  display: inline-block;  border-radius: 50%;  left: 150px;  position: relative;  background-color: #2980b9;}.text {  text-align: center;  font-family: 'Lobster', cursive;  font-size: 74px;  display: inline-block;  transform: rotate(-15deg);  position: absolute;  margin: 50px 30px;  color: #ffffff;  text-shadow: 3px 3px 2px rgba(0, 0, 0, 0.5);}.text > small {  font-size: 20px;  display: block;}@keyframes rub-left {  0% {    margin-left: 0px;    margin-top: 0;  }  50% {    margin-left: 5px;    margin-top: 1px;  }  100% {    margin-left: 0px;    margin-top: 0;  }}@keyframes rub-right {  0% {    margin-left: 4px;  }  50% {    margin-left: 0px;  }  100% {    margin-left: 4px;  }}@keyframes jump {  0% {    margin: 300px auto;  }  40% {    margin: 250px auto;  }  80% {    margin: 300px auto;  }}

via: http://www.w2bc.com/Article/13508

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
HTMLドキュメントのルートタグは何ですか?HTMLドキュメントのルートタグは何ですか?Apr 29, 2025 am 12:10 AM

Theroottaginanhtmldocumentis.itservesStop-levellementThateChationCothercontent、ProperDocumentsTurcuteRuctureAndBrowsingを保証します。

HTMLタグと要素は同じものですか?HTMLタグと要素は同じものですか?Apr 28, 2025 pm 05:44 PM

この記事では、HTMLタグは要素を定義するために使用される構文マーカーであり、要素はタグやコンテンツを含む完全なユニットであると説明しています。彼らは協力してWebPages.Characterカウントを構築するために協力します:159

&lt; head&gt;の重要性は何ですかおよび&lt; body&gt; HTMLのタグ?&lt; head&gt;の重要性は何ですかおよび&lt; body&gt; HTMLのタグ?Apr 28, 2025 pm 05:43 PM

この記事では、&lt; head&gt;の役割について説明します。および&lt; body&gt; HTMLのタグ、ユーザーエクスペリエンスへの影響、およびSEOの影響。適切な構造化により、ウェブサイトの機能と検索エンジンの最適化が強化されます。

&lt; strong&gt;&lt; b&gt;の違いは何ですかタグと&lt; em&gt;&lt; i&gt;タグ?&lt; strong&gt;&lt; b&gt;の違いは何ですかタグと&lt; em&gt;&lt; i&gt;タグ?Apr 28, 2025 pm 05:42 PM

この記事では、HTMLタグの違いについて説明します。、、、、、、、およびプレゼンテーションの使用とSEOとアクセシビリティへの影響に焦点を当てています。

HTMLのドキュメントで使用されている文字セットを示す方法を説明してください。HTMLのドキュメントで使用されている文字セットを示す方法を説明してください。Apr 28, 2025 pm 05:41 PM

記事では、UTF-8に焦点を当てたHTMLでのキャラクターエンコーディングの指定について説明します。主な問題:テキストの正しい表示を確保し、文字化けされたキャラクターの防止、SEOとアクセシビリティの強化。

HTMLのさまざまなフォーマットタグは何ですか?HTMLのさまざまなフォーマットタグは何ですか?Apr 28, 2025 pm 05:39 PM

この記事では、Webコンテンツの構築とスタイリングに使用されるさまざまなHTMLフォーマットタグについて説明し、テキストの外観に対する影響とアクセシビリティとSEOのセマンティックタグの重要性を強調しています。

「ID」属性とHTML要素の「クラス」属性の違いは何ですか?「ID」属性とHTML要素の「クラス」属性の違いは何ですか?Apr 28, 2025 pm 05:39 PM

この記事では、HTMLの「ID」属性と「クラス」属性の違いについて説明し、一意性、目的、CSS構文、および特異性に焦点を当てています。それらがWebページのスタイリングと機能にどのように影響するかを説明し、のベストプラクティスを提供する

HTMLの「クラス」属性とは何ですか?HTMLの「クラス」属性とは何ですか?Apr 28, 2025 pm 05:37 PM

この記事では、スタイリングとJavaScriptの操作の要素をグループ化するHTML「クラス」属性の役割を説明し、一意の「ID」属性とは対照的です。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 Linux 新バージョン

SublimeText3 Linux 新バージョン

SublimeText3 Linux 最新バージョン

WebStorm Mac版

WebStorm Mac版

便利なJavaScript開発ツール

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

PhpStorm Mac バージョン

PhpStorm Mac バージョン

最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール