SlideShare a Scribd company logo
2016年8月6日 齊藤 修一
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_001
CSS3 によるアニメーション表現
WordBench 新潟
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_002
CSS によるアニメーション
CSS3 より登場した、
アニメーション(動き)を表現する 2 つのプロパティ。
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_003
CSS によるアニメーション
「 transition 」と「 animation 」
トランジション アニメーション
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_004
2 つのプロパティの違い
transition
・:hover などをトリガーとして、要素のプロパティの値を変化させる。
・ループなし
animation
・ページ表示後に要素のプロパティの値を変化させる。
・複雑な処理が可能。
・ループあり
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_005
transition の対応ブラウザ
・IE9 以下が非対応。ただし IE9 のサポートは Windows Vista のみ
2017 年 4 月まで。
IE9 以下に対応する必要がある場合は、
プログレッシブエンハンスメントの考え方を採用するなどの対策をとる
・古い Android Browser 用にベンダープレフィックス(webkit)の設定が必要
http://caniuse.com/#search=transition
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_006
transition のサンプルコード
.demo_transition {
width: 200px;
height: 150px;
background: #00F;
transition-property: background, width;
transition-duration: 2s;
transition-timing-function: ease-out;
transition-delay: 0;
}
.demo_transition:hover{
width: 300px;
background: #f00;
}
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_007
transition のサンプルコード
.demo_transition {
width: 200px;
height: 150px;
background: #00F;
transition-property: background, width;
transition-duration: 2s;
transition-timing-function: ease-out;
transition-delay: 0;
}
.demo_transition:hover{
width: 300px;
background: #f00;
}
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_008
transition のプロパティ
transition-property
・transition 効果を指定するプロパティ
・カンマ区切りで複数指定が可能、all で全体指定
transition-duration
・アニメーションで変化する時間の長さを指定
・カンマ区切りでプロパティごとに指定が可能
transition-timing-function
・変化の仕方を指定
・ease、linear、ease-in、ease-out などさまざまな指定方法がある
transition-delay
・transition 実行までの待ち時間
・0 の場合は即実行
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_009
transition のサンプルコード(ショートハンド)
transition-property: background, width;
transition-duration: 2s;
transition-timing-function: ease-out;
transition-delay: 0;
↓
transition: background 2s ease-out 0, width 2s ease-out 0;
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_010
transition のサンプルコード(ショートハンド)
transition: background 2s ease-out 0, width 2s ease-out 0;
・プロパティが複数ある場合は、カンマで区切る
・それぞれ省略が可能。
・transition-property を省略すると全体(all)にかかる。初期値が all のため。
・基本的に順不同だが、transition-duration は transition-delay より先に書く。
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_011
transition のトリガー
:hover
マウスオンで動作
:active
リンクをクリックしている間などに動作。クリックしたままにする必要がある。
:target
ページ内リンク等で、#test などで指定が入った部分に適用
:focus
input など、focus した際に適用
:checked
チェックボックスやラジオボタンでチェックが入った際に適用
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_012
transition のトリガー
jQuery
jQuery の toggleClass などを利用して、class を追加・削除することで起動
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_013
animation の対応ブラウザ
・IE9 以下が非対応。ただし IE9 のサポートは Windows Vista のみ
2017 年 4 月まで。
IE9 以下に対応する必要がある場合は、
プログレッシブエンハンスメントの考え方を採用するなどの対策をとる
・古い Android Browser 用にベンダープレフィックス(webkit)の設定が必要
http://caniuse.com/#search=animation
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_014
animation のサンプルコード
.demo {
animation-name: demo_animation;
animation-duration: 2s;
animation-iteration-count: infinite;
}
@keyframes demo_animation {
from {
width: 200px;
height: 140px;
background: #fff;
}
to {
width: 400px;
height: 220px;
background: #ff0;
}
}
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_015
animation のサンプルコード
.demo {
animation-name: demo_animation;
animation-duration: 2s;
animation-iteration-count: infinite;
}
@keyframes demo_animation {
from {
width: 200px;
height: 140px;
background: #fff;
}
to {
width: 400px;
height: 220px;
background: #ff0;
}
}
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_016
animation のサンプルコード
.demo {
animation-name: demo_animation;
animation-duration: 2s;
animation-iteration-count: infinite;
}
@keyframes demo_animation {
from {
width: 200px;
height: 140px;
background: #fff;
}
to {
width: 400px;
height: 220px;
background: #ff0;
}
}
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_017
animation のプロパティ
animation-name
・アニメーションの名前を指定
・具体的な動きは @keyframes で指定
animation-duration
・アニメーションが 1 週するのに掛かる時間を設定
animation-iteration-count
・アニメーションを繰り返す回数を指定
・infinite は無限。初期値は 1。 0 の場合は実行しない
animation-timing-function
・変化の仕方を指定
・ease、linear、ease-in、ease-out などさまざまな指定方法がある。
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_018
animation のプロパティ
animation-delay
・要素が読み込まれてからアニメーションを始めるまでの待ち時間
・初期値は 0 で、その場合は即実行
animation-direction
・アニメーション終了時に、逆方向にアニメーションして繰り返すか、
始めの状態にリセットしてアニメーションを繰り返すかを設定
・値は初期値である normal、逆方向に再生する場合は alternate
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_019
animation のサンプルコード(ショートハンド)
animation-name: demo_animation;
animation-duration: 3s;
animation-timing-function: ease;
animation-iteration-count: infinite;
animation-delay: 0;
↓
animation: demo_animation 3s ease infinite 0;
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_020
animation のサンプルコード(ショートハンド)
animation: demo_animation 3s ease infinite 0;
・それぞれ省略が可能。
・基本的に順不同だが、animation-duration を animation-delay より先に書く。
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_021
animation の keyframes
@keyframes demo_animation {
0% {
width: 200px;
height: 100px;
background: #fff;
}
50% {
width: 450px;
height: 250px;
background: #ff0;
}
100% {
width: 100px;
height: 80px;
background: #000;
}
}
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_022
animation の keyframes
@keyframes demo_animation {
0% {
width: 200px;
height: 100px;
background: #fff;
}
50% {
width: 450px;
height: 250px;
background: #ff0;
}
100% {
width: 100px;
height: 80px;
background: #000;
}
}
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_023
from(0%)
50%
開始 終了
to(100%)
animation の keyframes
2016年8月6日_WordBench新潟_CSS3によるアニメーション表現_024
animation の keyframes
animation: demo_animation 3s ease infinite 0;
・アニメーションの最初と最後、その途中の各地点での状態を設定。
・最初は from ( もしくは 0%)、最後は to ( もしくは 100%) と記載する。
・最初と最後は必須、ないと動かない。
・途中に 20%、40%、70%・・・など複数増やせる。

More Related Content

Recently uploaded

Generating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language ModelsGenerating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language Models
harmonylab
 
This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.
chiefujita1
 
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
t m
 
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさJSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
0207sukipio
 
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアルLoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
CRI Japan, Inc.
 
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
Matsushita Laboratory
 
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
Toru Tamaki
 
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援しますキンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
Takayuki Nakayama
 

Recently uploaded (8)

Generating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language ModelsGenerating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language Models
 
This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.
 
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
 
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさJSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
 
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアルLoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
 
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
 
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
 
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援しますキンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
 

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

CSS3によるアニメーション表現