clay-core
Version:
Provide a more friendly web-side drawing interface!
45 lines (41 loc) • 1.35 kB
HTML
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="../../libs/easycss-1.3.1.min.css">
<link rel="stylesheet" href="../../libs/prettify.css">
<link rel="stylesheet" href="../../doc.css">
<script src="../../libs/prettify.js"></script>
</head>
<body onload="prettyPrint()">
<header>
坐标变换
</header>
<p>
更全面的坐标变换请使用Matrix4矩阵实现,这里的坐标变换是为了方便2D下的操作,比矩阵高效(在某些情况下)。
</p>
<h2>
rotate
</h2>
<pre class='prettyprint lang-js'>var newP=$$.rotate(cx, cy, deg, x, y);</pre>
<p>
点(x,y)围绕中心(cx,cy)旋转deg度,返回新的坐标。
</p>
<h2>
move
</h2>
<pre class='prettyprint lang-js'>var newP=$$.move(ax, ay, d, x, y);</pre>
<p>
点(x,y)沿着向量(ax,ay)方向移动距离d,返回新的坐标。
</p>
<h2>
scale
</h2>
<pre class='prettyprint lang-js'>var newP=$$.scale(cx, cy, times, x, y);</pre>
<p>
点(x,y)围绕中心(cx,cy)缩放times倍,返回新的坐标。
</p>
</body>
</html>