Compare commits
2 Commits
525c9b0572
...
4a7dd980bd
Author | SHA1 | Date |
---|---|---|
zhaoqiang | 4a7dd980bd | |
zhaoqiang | f37c1ce336 |
|
@ -1323,26 +1323,19 @@ let handleAnimate = async (result: any) => {
|
|||
let middleDuration = duration / num1;
|
||||
|
||||
for (let i = 0; i < numTriangles; i++) {
|
||||
let triangle = draw
|
||||
.polygon("0,-2 6,0 0,2")
|
||||
.fill("lightgreen")
|
||||
.stroke({ color: "lightgreen", width: 0.2 });
|
||||
let triangle = draw.polygon('0,-1 4,0 0,1').fill('lightgreen').stroke({ color: 'lightgreen', width: 0.2 })
|
||||
|
||||
let triangleanimate = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"animateMotion"
|
||||
);
|
||||
triangleanimate.setAttribute("path", pointsValue);
|
||||
triangleanimate.setAttribute("dur", `${spacingDuration}s`);
|
||||
let startTime =
|
||||
middleDuration - (duration / numTriangles) * i - i * spacingDuration;
|
||||
triangleanimate.setAttribute("begin", `${startTime}s`);
|
||||
triangleanimate.setAttribute("fill", "remove");
|
||||
triangleanimate.setAttribute("rotate", "auto");
|
||||
triangleanimate.setAttribute("repeatCount", "indefinite");
|
||||
triangle.node.appendChild(triangleanimate);
|
||||
let triangleanimate = document.createElementNS('http://www.w3.org/2000/svg', 'animateMotion')
|
||||
triangleanimate.setAttribute('path', pointsValue)
|
||||
triangleanimate.setAttribute('dur', `${spacingDuration}s`)
|
||||
let startTime = middleDuration - (duration / numTriangles) * i - i * spacingDuration
|
||||
triangleanimate.setAttribute('begin', `${startTime}s`)
|
||||
triangleanimate.setAttribute('fill', 'remove')
|
||||
triangleanimate.setAttribute('rotate', 'auto')
|
||||
triangleanimate.setAttribute('repeatCount', 'indefinite')
|
||||
triangle.node.appendChild(triangleanimate)
|
||||
|
||||
lineDom.add(triangle);
|
||||
lineDom.add(triangle)
|
||||
}
|
||||
let rect = draw.rect(30, 30).fill("#000").move(-5, -10);
|
||||
lineDom.add(rect);
|
||||
|
@ -1462,29 +1455,22 @@ let handleAnimate = async (result: any) => {
|
|||
let duration = numTriangles / num1;
|
||||
let middleDuration = duration / num1;
|
||||
for (let i = 0; i < numTriangles; i++) {
|
||||
let triangle = draw
|
||||
.polygon("0,-2 -6,0 0,2")
|
||||
.fill("lightgreen")
|
||||
.stroke({ color: "lightgreen", width: 0.2 });
|
||||
let triangle = draw.polygon('0,-1 -4,0 0,1').fill('lightgreen').stroke({ color: 'lightgreen', width: 0.2 })
|
||||
|
||||
let triangleanimate = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"animateMotion"
|
||||
);
|
||||
triangleanimate.setAttribute("path", pointsValue);
|
||||
triangleanimate.setAttribute("dur", `${spacingDuration}s`);
|
||||
let startTime =
|
||||
middleDuration - (duration / numTriangles) * i - i * spacingDuration;
|
||||
triangleanimate.setAttribute("begin", `${startTime}s`);
|
||||
triangleanimate.setAttribute("fill", "remove");
|
||||
triangleanimate.setAttribute("rotate", "auto");
|
||||
triangleanimate.setAttribute("repeatCount", "indefinite");
|
||||
triangleanimate.setAttribute("keyPoints", "1;0");
|
||||
triangleanimate.setAttribute("keyTimes", "0;1");
|
||||
triangleanimate.setAttribute("calcMode", "linear");
|
||||
triangle.node.appendChild(triangleanimate);
|
||||
let triangleanimate = document.createElementNS('http://www.w3.org/2000/svg', 'animateMotion')
|
||||
triangleanimate.setAttribute('path', pointsValue)
|
||||
triangleanimate.setAttribute('dur', `${spacingDuration}s`)
|
||||
let startTime = middleDuration - (duration / numTriangles) * i - i * spacingDuration
|
||||
triangleanimate.setAttribute('begin', `${startTime}s`)
|
||||
triangleanimate.setAttribute('fill', 'remove')
|
||||
triangleanimate.setAttribute('rotate', 'auto')
|
||||
triangleanimate.setAttribute('repeatCount', 'indefinite')
|
||||
triangleanimate.setAttribute('keyPoints', '1;0')
|
||||
triangleanimate.setAttribute('keyTimes', '0;1')
|
||||
triangleanimate.setAttribute('calcMode', 'linear')
|
||||
triangle.node.appendChild(triangleanimate)
|
||||
|
||||
lineDom.add(triangle);
|
||||
lineDom.add(triangle)
|
||||
}
|
||||
let rect = draw.rect(30, 30).fill("#000").move(-5, -10);
|
||||
lineDom.add(rect);
|
||||
|
@ -1506,12 +1492,12 @@ let handleAnimate = async (result: any) => {
|
|||
// 这是变压器上的文字和线段
|
||||
// 引出线
|
||||
draw
|
||||
.line(centerX, centerY, centerX + 20, centerY - 20)
|
||||
.line(centerX, centerY, centerX + 10, centerY - 10)
|
||||
.attr({
|
||||
"stroke-width": 0.1,
|
||||
id: "load_" + data.load_id,
|
||||
stroke: "green",
|
||||
"stroke-dasharray": "3,3",
|
||||
'stroke-width': 0.1,
|
||||
id: 'load_' + data.load_id,
|
||||
stroke: 'green',
|
||||
'stroke-dasharray': '1,1'
|
||||
})
|
||||
.font({ size: "8" });
|
||||
// 文本
|
||||
|
@ -1522,11 +1508,11 @@ let handleAnimate = async (result: any) => {
|
|||
).toFixed(4)} kVar`
|
||||
)
|
||||
.attr({
|
||||
x: centerX + 20,
|
||||
y: centerY - 20,
|
||||
id: "load_text" + data.load_id,
|
||||
"font-size": "4",
|
||||
leading: "0.9",
|
||||
x: centerX + 10,
|
||||
y: centerY - 10,
|
||||
id: 'load_text' + data.load_id,
|
||||
'font-size': '2',
|
||||
leading: '0.9'
|
||||
})
|
||||
.fill("green");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue