Directional gradients problems ( Candidate Recommendation )
Created by: apostolos
not compatible with the Working Draft spec.
gradient > .directional() should convert the degrees for the unprefixed linear-gradient because they areWorking Draft
0deg is a gradient line pointing to the right. Angles increase in a counterclockwise direction.
Candidate Recommendation
0deg is a gradient line pointing to the top. Angles increase in a clockwise direction. Old angles can be converted to new angles using the formula:
new = abs(old−450) mod 360
Possible solution
.directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
@stddeg: ~`(Math.abs(parseFloat("@{deg}")-450) % 360) + "deg"`;
background-color: @endColor;
background-repeat: repeat-x;
background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+
background-image: -ms-linear-gradient(@deg, @startColor, @endColor); // IE10
background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+
background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10
background-image: linear-gradient(@stddeg, @startColor, @endColor); // The standard
}