You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-transforms] Have scale function accept percentage value #3399
Hello,
I would like to suggest adding percentage for scale function in transformations.
Current state: scale() is using [-NUM, NUM] where NUM is whole number (integer)
Suggestion: scale() will support [-NUM, NUM] and [-%, %]
Example: transform: scale(120%) will work same as transform:scale(1.2) is working right now.
Agree this is a nice to have, would be more intuitive for many authors (scale(50%) instead of scale(0.5), scale(150%) instead of scale(1.5)). The impact on implementations would be restricted to parsing time — computed/serialized values would remain numbers.
It's very similar to the change in alpha values to support percentages, which the WG re-affirmed in #3342 after browser teams emphasized their plan to ship.
The CSS Working Group just discussed Have scale function accept percentage value, and agreed to the following:
RESOLVED: Allow percentages inside the scale
The full IRC log of that discussion
<dael> Topic: Have scale function accept percentage value
<dael> github: https://github.com//issues/3399
<dael> AmeliaBR: This was a community suggestion that scale transforms that current accept number also accept % values, transform-scale: 150% instead of 1.5
<dael> AmeliaBR: Question of author conveience and intuitiveness. We've done this recently for opacity. Just like that it would only effect parsing. Actual rendering wouldn't change.
<dael> AmeliaBR: Question of if people think it's enough value to users to change parsing code
<dael> Rossen_: Any expection for how computed serializes
<dael> AmeliaBR: I would assume convert to simple number
<dael> TabAtkins: Given this is a place where number represents same as % I'm fine with it. It's low value, but low effort and I'm good with being more consistent across the language.
<dael> TabAtkins: Idea is it would parse into a number internally and serialize as a number
<dael> AmeliaBR: smfr can correct, but I assume this is transforms 2. I don't think any rush to get that to PR so we have time to ship impl
<heycam> +1 for consistency across all values that accept a proportion-like value
<dael> smfr: I think that's true. Would effect 2d transform functions. New in transforms 2. Fine with this
<dael> Rossen_: Obj to accept proposal Allow percentages inside the scale
<dael> RESOLVED: Allow percentages inside the scale
A convenient way, e.g. a keyword, to scale by √2 ≈ 1.414 or √½ ≈ 0.707 (as in ISO paper and pens) might also be nice. scale(sqrt(2)) also works, of course.
Activity
[-][css-transforms] [/-][+][css-transforms] Have scale function accept percentage value[/+]AmeliaBR commentedon Oct 2, 2019
Agree this is a nice to have, would be more intuitive for many authors (
scale(50%)instead ofscale(0.5),scale(150%)instead ofscale(1.5)). The impact on implementations would be restricted to parsing time — computed/serialized values would remain numbers.It's very similar to the change in alpha values to support percentages, which the WG re-affirmed in #3342 after browser teams emphasized their plan to ship.
css-meeting-bot commentedon Oct 2, 2019
The CSS Working Group just discussed
Have scale function accept percentage value, and agreed to the following:RESOLVED: Allow percentages inside the scaleThe full IRC log of that discussion
<dael> Topic: Have scale function accept percentage value<dael> github: https://github.com//issues/3399
<dael> AmeliaBR: This was a community suggestion that scale transforms that current accept number also accept % values, transform-scale: 150% instead of 1.5
<dael> AmeliaBR: Question of author conveience and intuitiveness. We've done this recently for opacity. Just like that it would only effect parsing. Actual rendering wouldn't change.
<dael> AmeliaBR: Question of if people think it's enough value to users to change parsing code
<dael> Rossen_: Any expection for how computed serializes
<dael> AmeliaBR: I would assume convert to simple number
<dael> TabAtkins: Given this is a place where number represents same as % I'm fine with it. It's low value, but low effort and I'm good with being more consistent across the language.
<dael> TabAtkins: Idea is it would parse into a number internally and serialize as a number
<dael> AmeliaBR: smfr can correct, but I assume this is transforms 2. I don't think any rush to get that to PR so we have time to ship impl
<heycam> +1 for consistency across all values that accept a proportion-like value
<dael> smfr: I think that's true. Would effect 2d transform functions. New in transforms 2. Fine with this
<dael> Rossen_: Obj to accept proposal Allow percentages inside the scale
<dael> RESOLVED: Allow percentages inside the scale
birtles commentedon Oct 2, 2019
Presumably this should also apply to the individual scale property (and not just the
scale()function).Crissov commentedon Oct 3, 2019
A convenient way, e.g. a keyword, to scale by √2 ≈ 1.414 or √½ ≈ 0.707 (as in ISO paper and pens) might also be nice.
scale(sqrt(2))also works, of course.[css-transforms] scale function and property %
[css-transforms] scale function and property %
tabatkins commentedon Oct 7, 2019
Yes, now that
sqrt()exists, that case is well handled.[css-transforms] scale function and property %
[css-transforms] scale function and property %
BorisChiou commentedon Dec 3, 2019
Agree, and Gecko just landed it (based on the spec PR).
CSS Transforms: scale() accepts percentages.
CSS Transforms: scale() accepts percentages.
CSS Transforms: scale() accepts percentages.
CSS Transforms: scale() accepts percentages.
Bug 1701384 [wpt PR 28267] - CSS Transforms: scale() accepts percenta…
Bug 1701384 [wpt PR 28267] - CSS Transforms: scale() accepts percenta…