- Rutgers Design 2B: W4
- CSS Animations
- Key Frames
- Animation Properties
- This is the correct order:
- animation-timing-function
- animation-delay
- animation-iteration-count
- animation-direction
- animation-fill-mode
- animation-play-state
- References
- SVG
- Practice
- About prefixes (AKA webkit animation fields)
- Activity – Abstracted Vday Cards
- Accessible Colors (especially for type)
- Z index
- Resources
Visible to members of this folder
CSS Animations
Key Frames
<!DOCTYPE html>
<html>
<head>
<title>Animation Activity</title>
<link rel="stylesheet" type="text/css" href="assets/css/main.css">
</head>
<body>
<div class="container">
<div class="item">
Hello there!
</div>
</div>
</body>
</html>
body {
background-color: pink;
font-family: arial;
color: red;
font-size: 100px;
}
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
}
.item {
text-align: center;
}
@keyframes animationTitle {
}
@keyframes spinType {
0% {
}
60% {
}
100% {
}
}
@keyframes spinType {
0% {
transform: rotate(0.5turn);
}
60% {
transform: rotate(0.7turn);
}
100% {
transform: rotate(1turn);
}
}
Animation Properties
div.item {
animation: spinType 2s;
}
div.item {
animation-duration: 2s;
animation-name: spinType;
}
animation-timing-function
animation-delay
animation-delay: 5s;
animation: [animation-name] [animation-duration] [animation-timing-function]
[animation-delay];
animation: bounceIn 2s ease-in-out 3s;
animation-iteration-count
animation-direction
animation-fill-mode
animation-play-state
References
SVG
<div>
<img src="assets/imgs/yin-yang.svg">
</div>
img {
height:500px;
}
<!DOCTYPE html>
<html>
<head>
<title>Animation Activity</title>
<link rel="stylesheet" type="text/css" href="assets/css/main.css">
</head>
<body>
<div class="container">
<div>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><style>.cls-1{fill:#d2928b;}</style></defs><title>yin-yang</title><path class="cls-1" d="M337,609.25c10.48-51.08,44.58-95.11,94.05-112.62,49.21-17.41,103.15-15.08,152-33.85,79.83-30.66,128-115.65,123.74-199.57C702.2,172.28,633.36,106.06,545,93.1,315.1,59.34,100.05,258.49,90.84,483.47q-.34,8.26-.34,16.53c0,214.75,165.31,390.88,375.62,408.11C382.76,825.82,313.1,725.93,337,609.25ZM500,246a42.5,42.5,0,1,1-42.5,42.5A42.5,42.5,0,0,1,500,246Z"/><circle class="cls-1" cx="500" cy="711.5" r="42.5"/></svg>
</div>
</div>
</body>
</html>
#yin-yang {
height:500px;
}
About prefixes (AKA webkit animation fields)
Activity – Abstracted Vday Cards
Accessible Colors (especially for type)
Z index
.item-1 {
z-index: 1;
}
.item-2 {
z-index: 2;
}
Resources