3.4 KiB
3.4 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d78a9367417b2b2512aea | Make Motion More Natural Using a Bezier Curve | 0 | جعل الحركة أكثر طبيعية باستخدام منحنى بيزيير |
Description
linear
ease-out
، ولكن لا يصور أي منهما حركة شعوذة بدقة. تحتاج إلى تخصيص منحنى بيزير لهذا الغرض. animation-timing-function
تلقائيًا في كل إطار مفتاحي عند تعيين عدد مرات تشغيل animation-iteration-count
غير محدود. نظرًا لوجود قاعدة الإطار الرئيسي التي تم تعيينها في منتصف مدة الرسوم المتحركة ( 50%
) ، يؤدي ذلك إلى تقدمين متتاليين للرسوم المتحركة في حركة الكرة إلى أعلى وإلى أسفل. يحاكي المنحنى Bezier التكعيبي التالي حركة شعوذة: cubic-bezier(0.3, 0.4, 0.5, 1.6);
لاحظ أن قيمة y2 أكبر من 1. على الرغم من أن المنحنى Bezier المكعّب يتم تعيينه على نظام إحداثيات 1 × 1 ، ولا يمكنه قبول سوى قيم x من 0 إلى 1 ، يمكن تعيين قيمة y لأعداد أكبر من واحد. هذا يؤدي إلى حركة كذاب مثالية لمحاكاة الكرة شعوذة. Instructions
animation-timing-function
للعنصر مع معرف green
إلى وظيفة بيكي cubic-bezier
مع قيم x1 و y1 و x2 و y2 على التوالي إلى 0.311 ، 0.441 ، 0.444 ، 1.649. Tests
tests:
- text: يجب أن تكون قيمة خاصية <code>animation-timing-function</code> للعنصر ذي معرف <code>green</code> عبارة <code>cubic-bezier</code> وظيفة <code>cubic-bezier</code> بقيم x1 و y1 و x2 و y2 كما هو محدد.
testString: 'assert($("#green").css("animation-timing-function") == "cubic-bezier(0.311, 0.441, 0.444, 1.649)", "The value of the <code>animation-timing-function</code> property for the element with the id <code>green</code> should be a <code>cubic-bezier</code> function with x1, y1, x2, y2 values as specified.'
Challenge Seed
<style>
.balls {
border-radius: 50%;
position: fixed;
width: 50px;
height: 50px;
top: 60%;
animation-name: jump;
animation-duration: 2s;
animation-iteration-count: infinite;
}
#red {
background: red;
left: 25%;
animation-timing-function: linear;
}
#blue {
background: blue;
left: 50%;
animation-timing-function: ease-out;
}
#green {
background: green;
left: 75%;
animation-timing-function: cubic-bezier(0.69, 0.1, 1, 0.1);
}
@keyframes jump {
50% {
top: 10%;
}
}
</style>
<div class="balls" id="red"></div>
<div class="balls" id="blue"></div>
<div class="balls" id="green"></div>
Solution
// solution required