Joined March 2012
·
Posted to
CSS transition with auto width or height
over 1 year
ago
Since the estimated max-height, 1000px in this example, must exceed the actual height with a good margin there will be a delay when transitioning down from this max-height before it starts to actually limit the real height.
This delay can be minimized using an easing curve with a steep leading edge:
transition-timing-function: cubic-bezier(0, 1, 0, 1)
Be sure not to use the same easing curve when transitioning up.
Achievements
51 Karma
0 Total ProTip Views

Velociraptor
Have at least one original repo where Perl is the dominant language

Velociraptor 3
Have at least three original repos where Perl is the dominant language

Forked
Have a project valued enough to be forked by someone else

Nephila Komaci
Have at least one original repos where PHP is the dominant language

Charity
Fork and commit to someone's open source project in need
What "crispEdges" does is basically it disables anti-aliasing.
The reason one pixel lines look blurred is that SVG, just like Canvas, considers whole numbered coordinates to fall in between pixels.
If you draw a line with a 1px wide stroke on a half coordinate it will look sharp even without "crispEdges".
See the example, the first line will produce a two pixel wide gray line due to anti-aliasing, but both the other lines will produce a sharp one pixel wide black line.
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"> <line x1="0" y1="4" x2="16" y2="4" stroke="#000" stroke-width="1" /> <line x1="0" y1="8" x2="16" y2="8" stroke="#000" stroke-width="1" shape-rendering="crispEdges"/> <line x1="0" y1="11.5" x2="16" y2="11.5" stroke="#000" stroke-width="1" /> </svg>