html - CSS animation help. Code explanation required -
this question has answer here:
- how select classes spaces 5 answers
i have been trying figure out piece of css animation . not able understand how did creator manage elongate toggle smoothly , without keyframe animation or transform property ? on html side, <b>
tags doing ? if notice b tags have classes assigned them as
<b class="b switch"></b>
but same class selected css
.switch{ }
how work without "b" ? in advance.
the animation css transition
small delay. @ transition
, transition-property
, transition-delay
calls in codepen example like:
.check:checked ~ .switch { right: 2px; left: 22px; transition: .35s cubic-bezier(0.785, 0.135, 0.150, 0.860); transition-property: left, right; transition-delay: .05s, 0s; }
and there's cubic-brezier transition applied .track
element when checked element needs return original css , position.
the cubic brezier curve type used in vector animations , curve (and parameters ilsted in brackets) combined transition delay accounts smoothness.
the basic idea behind our above code block is:
the transition duration total of .35s
(because transition: .35s cubic-bezier(0.785, 0.135, 0.150, 0.860);
) , translate accross css right
, left
values in accordance transition-property: left, right;
. in addition, there small delay time added elements transition values. transition of left
value passed delay of .05s
while right
property given no delay passing delay 0s
.
for cubic-bezier transition itself, it's little more complex don't worry not much. can think of each of 4 values given in brackets points on x , y axis control velocity @ element transition @ given moment during transition sequence of cubic-bezier(p0,p1,p2,p3);
in other words, smoothes out animation making animation timing non-linear.
for more cubic-brezier transitions see tutorial , demo: http://www.hongkiat.com/blog/css-cubic-bezier/
the <b>
tag can used denote bold text. here it's not doing though. designers use <i>
(which italics) or <b>
tags place holder element they've assigned background img or other visual styling because since <b>
tag effects text can sure css won't effected html call.
Comments
Post a Comment