qrDecompose()方法用于将指定的标准2×3矩阵分解为变换分量
用法:
qrDecompose( mat )
参数:此方法接受如上所述和以下描述的参数:
- mat:此参数保存变换矩阵的指定数组。
返回值:此方法返回转换的组成部分。
范例1:
Javascript
<!DOCTYPE html>
<html>
<head>
<!-- Adding the FabricJS library -->
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js">
</script>
</head>
<body>
<script type="text/javascript">
// Calling qrDecompose() function over
// the specified array of transform matrix
console.log(fabric.util
.qrDecompose([1, 2, 3, 4, 5, 6]));
</script>
</body>
</html>
输出:
{"angle":63.434948822922,"scaleX":2.23606797749979,"scaleY":-0.8944271909999159, "skewX":65.55604521958347,"skewY":0,"translateX":5,"translateY":6}
范例2:
Javascript
<!DOCTYPE html>
<html>
<head>
<!-- Adding the FabricJS library -->
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js">
</script>
</head>
<body>
<script type="text/javascript">
// Specifying some array of transform matrix
var a1 = [1, 2, 3];
var a2 = [0, 6, 7, 8, 0, 0];
// Calling qrDecompose() function over the
// above specified array of transform matrix
console.log(fabric.util.qrDecompose(a1));
console.log(fabric.util.qrDecompose(a2));
</script>
</body>
</html>
输出:
{"angle":63.434948822922,"scaleX":2.23606797749979,"scaleY":null,"skewX":null,"skewY":0} {"angle":90,"scaleX":6,"scaleY":-7,"skewX":53.13010235415598,"skewY":0, "translateX":0,"translateY":0}
相关用法
- Lodash _.method()用法及代码示例
- Node.js Http2ServerRequest.method用法及代码示例
- Node.js http.IncomingMessage.method用法及代码示例
- Javascript dataView.getInt16()用法及代码示例
- Javascript RegExp toString()用法及代码示例
- Node.js URLSearchParams.has()用法及代码示例
- JavaScript Math cosh()用法及代码示例
- HTML DOM isEqualNode()用法及代码示例
- JavaScript Date toLocaleTimeString()用法及代码示例
- Node.js crypto.createHash()用法及代码示例
- Node.js writeStream.clearLine()用法及代码示例
- Node.js fs.link()用法及代码示例
- JavaScript Math random()用法及代码示例
- JavaScript Math round()用法及代码示例
- Javascript toString()用法及代码示例
- Javascript Number.isInteger( )用法及代码示例
- Javascript Number.isFinite()用法及代码示例
- Javascript toFixed()用法及代码示例
- Javascript toPrecision()用法及代码示例
- JavaScript Math abs()用法及代码示例
- JavaScript Math sqrt()用法及代码示例
- JavaScript Math floor()用法及代码示例
注:本文由纯净天空筛选整理自Kanchan_Ray大神的英文原创作品 Fabric.js qrDecompose() Method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。