Transitions (အကူးအပြောင်း)
ဘယ်လို သုံးမလဲ?
Section titled “ဘယ်လို သုံးမလဲ?”Transition effect ကို သုံးချင်တယ်ဆိုရင်၊ အဲဒီပြောင်းလဲချင်တဲ့ Element မှာ transition Property ကို ထည့်ပေးရပါမယ်။
ဒီနေရာမှာ အရေးကြီးတာက transition ကို Hover လုပ်တဲ့ Class (Mouse တင်တဲ့အချိန်) မှာ သွားမထည့်ဘဲနဲ့၊ မူလ Class ထဲမှာပဲ မဖြစ်မနေ ထည့်ပေးရပါမယ်။
.button { background-color: blue; color: white; /* Property, Duration, Timing-Function */ transition: background-color 0.3s ease;}
.button:hover { background-color: darkblue; /* Mouse တင်ရင် ဒီအရောင်ကို 0.3 စက္ကန့်အတွင်း ပြောင်းသွားမယ် */}Transition Properties
Section titled “Transition Properties”- Property: ဘယ်အရာကို ပြောင်းလဲမှာလဲ? (ဥပမာ - အကုန်ပြောင်းမှာဆိုရင်
all၊ အရောင်ပဲဆိုbackground-color၊ အကျယ်ပဲဆိုwidthစသဖြင့်) - Duration: ပြောင်းလဲသွားဖို့ အချိန် ဘယ်လောက် ယူမှာလဲ? (ဥပမာ -
0.3s,1s,500ms) - Timing Function: ဘယ်လို အမြန်နှုန်းနဲ့ အကူးအပြောင်း လုပ်မှာလဲ?
linear: အစကနေ အဆုံးအထိ အမြန်နှုန်း တစ်သမတ်တည်း သွားမယ်။ease: အစမှာ နှေးမယ်၊ အလယ်မှာ မြန်မယ်၊ အဆုံးမှာ ပြန်နှေးသွားမယ်။ (ဒါက အမြင်မှာ အသဘာဝကျဆုံး ဖြစ်လို့ Default အနေနဲ့ သုံးပါတယ်)ease-in: အစမှာ နှေးနှေးလေး စမယ်။ease-out: အဆုံးသတ်တဲ့အခါ နှေးနှေးလေး အဆုံးသတ်မယ်။
.card { transition: all 0.5s ease-in-out;}