Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- /*
- Created on : 13.08.2019, 14:21:51
- Author : kruse
- */
- /*
- Element 1
- Das Element fällt herunter beschleunigt, prallt noch oben ab, bremst ab und
- fällt wieder herunter, beschleunigt, usw. (im Prinzip ein prallender Ball)
- */
- body {
- overflow: hidden;
- }
- div.element1 {
- position: fixed;
- top: 0;
- left: 0;
- border-radius: 100px;
- width: 50px;
- height: 50px;
- background-color: blue;
- color: white;
- font-weight: bold;
- text-align: center;
- line-height: 50px;
- animation: element1 3s infinite;
- -webkit-animation: element1 3s infinite linear;
- }
- @keyframes element1 {
- 0% { top: 0; }
- 5% { top: 2.5%; }
- 10% { top: 5.8%; }
- 15% { top: 13.3%; }
- 20% { top: 21.5%; }
- 25% { top: 40.9%; }
- 30% { top: 56.8%; }
- 35% { top: 86.3%; }
- 40% { top: 89.5%; transform: scale(1.1, .9); }
- 50% { top: calc(100% - 50px); transform: scale(1.4, .6); }
- 55% { top: calc(92% - 50px); transform: scale(1.2, .8); }
- 60% { top: 78.4%; transform: scale(1.05, .95); }
- 65% { top: 62.5%; }
- 70% { top: 40.9%; }
- 75% { top: 21.5%; }
- 80% { top: 11.3%; }
- 85% { top: 6.8%; }
- 90% { top: 4.5%; }
- 95% { top: 2.5%; }
- 100% { top: 0; }
- }
- @-webkit-keyframes element1 {
- 0% { top: 0; }
- 5% { top: 2.5%; }
- 10% { top: 5.8%; }
- 15% { top: 13.3%; }
- 20% { top: 21.5%; }
- 25% { top: 40.9%; }
- 30% { top: 56.8%; }
- 35% { top: 86.3%; }
- 40% { top: 89.5%; transform: scale(1.1, .9); }
- 50% { top: calc(100% - 50px); transform: scale(1.4, .6); }
- 55% { top: calc(92% - 50px); transform: scale(1.2, .8); }
- 60% { top: 78.4%; transform: scale(1.05, .95); }
- 65% { top: 62.5%; }
- 70% { top: 40.9%; }
- 75% { top: 21.5%; }
- 80% { top: 11.3%; }
- 85% { top: 6.8%; }
- 90% { top: 4.5%; }
- 95% { top: 2.5%; }
- 100% { top: 0; }
- }
- /*
- Element 2
- Das Element soll von der oberen linken Ecke, in die untere Ecke wandern. Dieser
- Vorgang soll 10x wiederholt werden. Der Start erfolgt erst nach 2 Sekunden.
- */
- div.element2 {
- background-color: green;
- top: 0;
- left: 0;
- width: 50px;
- height: 50px;
- border-radius: 100px;
- position: absolute;
- color: white;
- font-weight: bold;
- text-align: center;
- line-height: 50px;
- animation: element2 5s alternate linear;
- animation-iteration-count: 10;
- animation-delay: 2s;
- }
- @keyframes element2 {
- from {
- top: 0;
- left: 0;
- }
- to {
- top: calc(100% - 50px);
- left: calc(100% - 50px);
- }
- }
- @-webkit-keyframes element2 {
- from {
- top: 0;
- left: 0;
- }
- to {
- top: calc(100% - 50px);
- left: calc(100% - 50px);
- }
- }
- /*
- Element 3
- Das Element hat zunächst eine Größe von 0 Pixel in Breite und Höhe. Dann soll es
- auf 300 x 300 Pixel anwachsen und zum Schluss über die Transparenz (opacity)
- ausgeblendet werden. Der Start erfolt nach 4 Sekunden, der Vorgang wird 6x
- wiederholt.
- */
- .element3 {
- background-color: red;
- width: 0;
- height: 0;
- top: 0;
- right: 0;
- position: absolute;
- color: white;
- font-weight: bold;
- text-align: center;
- border-radius: 100%;
- animation: element3 1s linear alternate;
- animation-iteration-count: 11;
- animation-delay: 4s;
- animation-fill-mode: forwards;
- }
- @keyframes element3 {
- 0% {
- width: 0;
- height: 0;
- font-size: 0;
- }
- 99.999% {
- width: 300px;
- height: 300px;
- font-size: 250px;
- }
- 100% {
- transition: opacity 4s;
- opacity: 0;
- }
- }
- @-webkit-keyframes element3 {
- 0% {
- width: 0;
- height: 0;
- }
- 99.999% {
- width: 300px;
- height: 300px;
- font-size: 250px;
- }
- 100% {
- background-color: black;
- }
- }
- </style>
- </head>
- <body>
- <div class="element1">1</div>
- <div class="element2">2</div>
- <div class="element3">3</div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement