blob: c5a34d3e401e733caa4a5a86b18cc94c8c7ff17c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
---
title: scaleX()
slug: Web/CSS/transform-function/scaleX()
tags:
- axial symmetry
- scaleX()
- scaleX(-1)
translation_of: Web/CSS/transform-function/scaleX()
---
<div>{{CSSRef}}</div>
<p><strong><code>scaleX()</code></strong> CSS 函数将每个元素点的横坐标修改为一个常数因子,除了该比例因子为1,在这种情况下,函数是身份变换。 缩放不是各向同性的,并且元素的角度不保守。</p>
<p><img src="https://mdn.mozillademos.org/files/12117/scaleX.png" style="height: 315px; width: 372px;"></p>
<p><code>scaleX(sx)</code> 是 <code>scale(sx, 1)</code> 或 <code>scale3d(sx, 1, 1) </code>的一个速记/缩写。</p>
<div class="note">
<p>Note:</p>
<p><strong><code>scaleX(-1)</code> </strong>定义一个 <a class="external" href="http://en.wikipedia.org/wiki/Axial_symmetry">轴向对称性(axial symmetry)</a> ,它具有一个垂直轴通过原点 (由 {{cssxref("transform-origin")}} 属性规定)。</p>
</div>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox">scaleX(<em>s</em>)
</pre>
<h2 id="Values">Values</h2>
<dl>
<dt><em>s</em></dt>
<dd>Is a {{cssxref("<number>")}} representing the scaling factor to apply on the abscissa of each point of the element.</dd>
</dl>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th>
<th scope="col">Homogeneous coordinates on ℝℙ<sup>2</sup></th>
<th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th>
<th scope="col">Homogeneous coordinates on ℝℙ<sup>3</sup></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="1" rowspan="2"><math> <mfenced> <mtable> <mtr><mtd>s</mtd><mtd>0</mtd></mtr> <mtr><mtd>0</mtd><mtd>1</mtd></mtr> </mtable> </mfenced> </math></td>
<td><math> <mfenced><mtable><mtr>s<mtd>0</mtd><mtd>0</mtd></mtr><mtr>0<mtd>1</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td>
<td colspan="1" rowspan="2"><math> <mfenced><mtable><mtr>s<mtd>0</mtd><mtd>0</mtd></mtr><mtr>0<mtd>1</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td>
<td colspan="1" rowspan="2"><math> <mfenced><mtable><mtr>s<mtd>0</mtd><mtd>0</mtd><mtd>0</mtd></mtr><mtr>0<mtd>1</mtd><mtd>0</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td>
</tr>
<tr>
<td><code>[s 0 0 1 0 0]</code></td>
</tr>
</tbody>
</table>
<h2 id="Examples">Examples</h2>
<h3 id="Without_changing_the_origin">Without changing the origin</h3>
<h4 id="HTML">HTML</h4>
<pre class="brush: html"><p>foo</p>
<p class="transformed">bar</p></pre>
<h4 id="CSS">CSS</h4>
<pre class="brush: css">p {
width: 50px;
height: 50px;
background-color: teal;
}
.transformed {
transform: scaleX(2);
background-color: blue;
}
</pre>
<h4 id="Result">Result</h4>
<p>{{EmbedLiveSample("Without_changing_the_origin","100%","200")}}</p>
<h3 id="Translating_the_origin_of_the_transformation">Translating the origin of the transformation</h3>
<h4 id="HTML_2">HTML</h4>
<pre class="brush: html"><p>foo</p>
<p class="transformed">bar</p></pre>
<h4 id="CSS_2">CSS</h4>
<pre class="brush: css">p {
width: 50px;
height: 50px;
background-color: teal;
}
.transformed {
transform: scaleX(2);
transform-origin: left;
background-color: blue;
}
</pre>
<h4 id="Result_2">Result</h4>
<p>{{EmbedLiveSample("Translating_the_origin_of_the_transformation","100%","200")}}</p>
|