آموزش انیمیشن در CSS3
![](https://www.sourcebaran.com/learn/wp-content/uploads/2021/02/045.jpg)
آموزش انیمیشن در CSS3
در این درس از مجموعه آموزش برنامه نویسی سایت سورس باران، به آموزش انیمیشن در CSS3 خواهیم پرداخت.
انیمیشن فرآیند ایجاد تغییر شکل و ایجاد حرکات با عناصر است.
keyframes
Keyframes مراحل انیمیشن میانی را در CSS3 کنترل می کند.
نمونه Keyframes با انیمیشن سمت چپ
1 2 3 4 5 6 7 8 9 10 11 |
@keyframes animation { from {background-color: pink;} to {background-color: green;} } div { width: 100px; height: 100px; background-color: red; animation-name: animation; animation-duration: 5s; } |
مثال بالا ارتفاع ، عرض ، رنگ ، نام و مدت زمان انیمیشن را با نحو keyframes نشان می دهد.
انیمیشن در حال حرکت سمت چپ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
} The above example shows height, width, color, name and duration of animation with keyframes syntax. Moving left animation Live Demo <html> <head> <style type = "text/css"> h1 { -moz-animation-duration: 3s; -webkit-animation-duration: 3s; -moz-animation-name: slidein; -webkit-animation-name: slidein; } @-moz-keyframes slidein { from { margin-left:100%; width:300% } to { margin-left:0%; width:100%; } } @-webkit-keyframes slidein { from { margin-left:100%; width:300% } to { margin-left:0%; width:100%; } } </style> </head> <body> <h1>Tutorials Point</h1> <p>this is an example of moving left animation .</p> <button onclick = "myFunction()">Reload page</button> <script> function myFunction() { location.reload(); } </script> </body> </html> |
خروجی به صورت زیر می باشد:
1 2 3 4 |
Tutorials Point this is an example of moving left animation . Reload page |
انیمیشن در حال حرکت سمت چپ با keyframes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
<html> <head> <style type = "text/css"> h1 { -moz-animation-duration: 3s; -webkit-animation-duration: 3s; -moz-animation-name: slidein; -webkit-animation-name: slidein; } @-moz-keyframes slidein { from { margin-left:100%; width:300% } 75% { font-size:300%; margin-left:25%; width:150%; } to { margin-left:0%; width:100%; } } @-webkit-keyframes slidein { from { margin-left:100%; width:300% } 75% { font-size:300%; margin-left:25%; width:150%; } to { margin-left:0%; width:100%; } } </style> </head> <body> <h1>Tutorials Point</h1> <p>This is an example of animation left with an extra keyframe to make text changes.</p> <button onclick = "myFunction()">Reload page</button> <script> function myFunction() { location.reload(); } </script> </body> </html> |
خروجی به صورت زیر می باشد:
1 2 3 4 |
Tutorials Point This is an example of animation left with an extra keyframe to make text changes. Reload page |
لیست جلسات قبل آموزش CSS
- آموزش CSS
- CSS چیست؟
- آموزش نحو CSS
- آموزش قوانین CSS
- آموزش واحد انداره گیری در CSS
- آموزش رنگ ها در CSS
- آموزش Background در CSS
- آموزش فونت ها در CSS
- آموزش استفاده از تصاویر در CSS
- آموزش استفاده از تصاویر در CSS
- آموزش استفاده از لینک ها در CSS
- آموزش جداول در CSS
- آموزش حاشیه در CSS
- آموزش margin در CSS
- آموزش لیست ها در CSS
- آمورش ویژگی padding در CSS
- آموزش ویژگی مکان نما در CSS
- آموزش outline در CSS
- آموزش ابعاد در CSS
- آموزش نوارهای پیمایشی در CSS
- آموزش visibility در CSS
- آموزش موقعیت یابی در CSS
- آموزش لایه ها در CSS
- آموزش شبه کلاس ها در CSS
- آموزش شبه عناصر در CSS
- آموزش قوانین @ در CSS
- آموزش فیلترهای متنی و تصویری در CSS
- آموزش انواع رسانه ها در CSS
- آموزش مدیا صفحه در CSS
- آموزش رسانه شنیداری در CSS
- آموزش چاپ در CSS
- آموزش طرح بندی در CSS
- آموزش CSS3
- آموزش گرد کردن گوشه ها در CSS3
- آموزش حاشیه تصویر CSS3
- آموزش تنظیم چند پس زمینه در CSS3
- رنگ ها در CSS3
- آموزش گرادیان در CSS3
- آموزش سایه در CSS3
- آموزش تکست در CSS3
- آموزش فونت های وب در CSS3
- آموزش تبدیل 2d در CSS3
- آموزش تبدیل سه بعدی در CSS3
دیدگاه شما