Skip to content

[css-transforms-2] Keywords for transform #944

@Crissov

Description

@Crissov

The transform property currently accepts none or a list of transform functions. I believe it would make sense to add some keywords for common use cases. This could make code more readable especially for beginners and math-illiterates.

Keyword Equivalent function
flip-vertical, flip? scale(1, -1)
flip-horizontal, mirror? scale(-1, 1)
mirror flip in writing direction?
rotate, flip?, straight, turn-down, down rotate(0.5turn) = flip-vertical flip-horizontal (rotate(straight)?)
rotate-clockwise, turn-right, right rotate(0.25turn) (rotate(right)?)
rotate-anticlockwise, turn-left, left rotate(0.75turn) or rotate(-0.25turn) (rotate(left)?)
flip-diagonal-right, flip-right turn-right flip-vertical = turn-left flip-horizontal
flip-diagonal-left, flip-left turn-right flip-horizontal = turn-left flip-vertical
spin, full, turn-up, up rotate(1turn) (only makes sense with animation)
north-north-east rotate(22.5deg)
clock-1 rotate(30deg)
north-east rotate(45deg)
clock-2 rotate(60deg)
east-north-east rotate(67.5deg)
clock-3, east rotate(90deg)
east-south-east rotate(112.5deg)
clock-4 rotate(120deg)
south-east rotate(135deg)
clock-5 rotate(150deg)
south-south-east rotate(157.5deg)
clock-6, south rotate(180deg)
south-south-west rotate(202.5deg)
clock-7 rotate(210deg)
south-west rotate(225deg)
clock-8 rotate(240deg)
west-south-west rotate(247.5deg)
clock-9, west rotate(270deg)
west-north-west rotate(292.5deg)
clock-10 rotate(300deg)
north-west rotate(315deg)
clock-11 rotate(330deg)
north-north-west rotate(337.5deg)
clock-12, north rotate(360deg)

In SVG, where transform-origin defaults to (0 0) instead of (50% 50%), flipping also requires a translation by the respective size (i.e. width or height) of the box.

The systematic rotations (which were added in early May 2019 to this issue) are obviously based upon twelfth-turns (clock) and sixteenth-, eighth- or quarter-turns (compass directions). Those could be implemented as global <angle> keywords in css-values instead, e.g. rotate(north-north-west) or perhaps rather rotate(NNW). This could also include special named angles like the Golden Angle of ca. 137.5° = π·(3−√5) and the Magic Angle of ca. 54.7° = arctan √2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions