diff options
Diffstat (limited to 'files/zh-tw/web/css/transform-function/translate3d/index.html')
-rw-r--r-- | files/zh-tw/web/css/transform-function/translate3d/index.html | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/files/zh-tw/web/css/transform-function/translate3d/index.html b/files/zh-tw/web/css/transform-function/translate3d/index.html new file mode 100644 index 0000000000..02a45a3186 --- /dev/null +++ b/files/zh-tw/web/css/transform-function/translate3d/index.html @@ -0,0 +1,117 @@ +--- +title: translate3d() +slug: Web/CSS/transform-function/translate3d +translation_of: Web/CSS/transform-function/translate3d() +original_slug: Web/CSS/transform-function/translate3d() +--- +<div>{{CSSRef}}</div> + +<p><strong><code>translate3d()</code></strong> <a href="/zh-TW/docs/Web/CSS">CSS</a> 函式以 3D 場境的方式定位元素。其結果為 {{cssxref("<transform-function>")}} 資料型別。</p> + +<div>{{EmbedInteractiveExample("pages/css/function-translate3d.html")}}</div> + + + +<p>這個轉場的特徵是三維向量,其坐標則定義元素的方向該如何移動。</p> + +<h2 id="語法">語法</h2> + +<pre class="syntaxbox notranslate">translate3d(tx, ty, tz) +</pre> + +<h3 id="數值">數值</h3> + +<dl> + <dt><code>tx</code></dt> + <dd>其 {{cssxref("<length>")}} 代表平移向量的橫坐標。</dd> + <dt><code>ty</code></dt> + <dd>其 {{cssxref("<length>")}} 代表平移向量的縱坐標。</dd> + <dt><code>tz</code></dt> + <dd>其 {{cssxref("<length>")}} 代表平移向量的 z 分量。數值不能是 {{cssxref("<percentage>")}}:否則,此轉場的屬性無效。</dd> +</dl> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">ℝ<sup>2</sup> 上的笛卡兒座標(Cartesian coordinate)</th> + <th scope="col">ℝℙ<sup>2</sup> 上的齊次坐標(homogeneous coordinates)</th> + <th scope="col">ℝ<sup>3</sup> 上的笛卡兒座標</th> + <th scope="col">ℝℙ<sup>3</sup> 上的齊次坐標</th> + </tr> + </thead> + <tbody> + <tr> + <td colspan="2" rowspan="2"> + <p>This transformation applies to the 3D space and can't be represented on the plane.</p> + </td> + <td colspan="1" rowspan="2">A translation is not a linear transformation in ℝ<sup>3</sup> and can't be represented using a Cartesian-coordinate matrix.</td> + <td colspan="1" rowspan="2"><math> <mfenced><mtable><mtr>1<mtd>0</mtd><mtd>0</mtd><mtd>tx</mtd></mtr><mtr>0<mtd>1</mtd><mtd>0</mtd><mtd>ty</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd><mtd>tz</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td> + </tr> + </tbody> +</table> + +<h2 id="示例">示例</h2> + +<h3 id="使用單軸平移">使用單軸平移</h3> + +<h4 id="HTML">HTML</h4> + +<pre class="brush: html notranslate"><div>Static</div> +<div class="moved">Moved</div> +<div>Static</div></pre> + +<h4 id="CSS">CSS</h4> + +<pre class="brush: css notranslate">div { + width: 60px; + height: 60px; + background-color: skyblue; +} + +.moved { + /* Equivalent to perspective(500px) translateX(10px) */ + transform: perspective(500px) translate3d(10px, 0, 0px); + background-color: pink; +} +</pre> + +<h4 id="結果">結果</h4> + +<p>{{EmbedLiveSample("Using_a_single_axis_translation", 250, 250)}}</p> + +<h3 id="Combining_z-axis_and_x-axis_translation">Combining z-axis and x-axis translation</h3> + +<h4 id="HTML_2">HTML</h4> + +<pre class="brush: html notranslate"><div>Static</div> +<div class="moved">Moved</div> +<div>Static</div></pre> + +<h4 id="CSS_2">CSS</h4> + +<pre class="brush: css notranslate">div { + width: 60px; + height: 60px; + background-color: skyblue; +} + +.moved { + transform: perspective(500px) translate3d(10px, 0, 100px); + background-color: pink; +} +</pre> + +<h4 id="結果_2">結果</h4> + +<p>{{EmbedLiveSample("Combining_z-axis_and_x-axis_translation", 250, 250)}}</p> + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +<p>請參見 <code><a href="/zh-TW/docs/Web/CSS/transform-function#Browser_compatibility"><transform-function></a></code>。</p> + +<h2 id="參見">參見</h2> + +<ul> + <li>{{cssxref("transform")}}</li> + <li>{{cssxref("<transform-function>")}}</li> +</ul> |