當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


CSS matrix3d()用法及代碼示例

matrix3d()函數是一個內置函數,用於應用變換以將3D變換創建為4×4齊次矩陣。

用法:

matrix3d( a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4 )

參數:該函數接受上麵提到和下麵描述的16個參數:


  • a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,d4:這些參數用於保存線性變換的值。
  • a4,b4,c4:這些參數用於保存轉換值。

下麵的示例說明了CSS中的matrix3d()函數:
例:

<!DOCTYPE html>  
<html>  
<head>  
    <title> 
        CSS matrix3d() function 
        </title>  
          
    <style>  
        .GFG {  
            transform:matrix3d( 
                0.6, 0.1, 0.7, 0, 
                -0.5, 0.8, 0.1, 0, 
                -0.6, -0.5, 0.5, 0, 
                0, 0, 0, 1 
            ); 
              
            font-size:26px; 
            font-weight:bold; 
            width:250px; 
            padding:20px; 
            background:green; 
            color:white; 
            font-family:sans-serif; 
        }  
    </style>  
      
</head>  
  
<body>  
    <center> 
        <h1 style="color:green">GeeksforGeeks</h1>  
        <h2>CSS matrix3d() function</h2>  
        <br><br>  
      
        <div class="GFG"> 
            Welcome to GeeksforGeeks 
        </div>  
    </center> 
</body>  
  
</html>                    

輸出:

支持的瀏覽器:下麵列出了matrix3d()函數支持的瀏覽器:

  • 穀歌瀏覽器
  • IE瀏覽器
  • 火狐瀏覽器
  • 蘋果瀏覽器
  • Opera


相關用法


注:本文由純淨天空篩選整理自jit_t大神的英文原創作品 CSS | matrix3d() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。