From 1d06a1f1f072c7366daaab49379e4f38b249453e Mon Sep 17 00:00:00 2001 From: jiaming <743192023@qq.com> Date: Wed, 12 Dec 2018 18:47:47 +0800 Subject: [PATCH] add get circle radian point fun --- src/plugins/canvasExtend.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/canvasExtend.js b/src/plugins/canvasExtend.js index 15ec7a7..86be556 100644 --- a/src/plugins/canvasExtend.js +++ b/src/plugins/canvasExtend.js @@ -140,6 +140,12 @@ export function getLinearGradientColor (ctx, begin, end, color) { return linearGradientColor } +export function getCircleRadianPoint (x, y, radius, radian) { + const { sin, cos } = Math + + return [x + cos(radian) * radius, y + sin(radian) * radius] +} + const canvas = { drawLine, drawPolylinePath, @@ -149,7 +155,8 @@ const canvas = { drawSmoothline, drawBezierCurveLinePath, drawPoints, - getLinearGradientColor + getLinearGradientColor, + getCircleRadianPoint } export default function (Vue) {