| | |
| | | if (!mapContainer || !sprite) { |
| | | return; |
| | | } |
| | | const data = sprite.data || (sprite.data = {}); |
| | | |
| | | if (data.rotationTween) { |
| | | data.rotationTween.stop(); |
| | | data.rotationTween = null; |
| | | } |
| | | // origin |
| | | let currentRotation = sprite.rotation + rotationOffset; |
| | | // target |
| | |
| | | // destination |
| | | const endRotation = sprite.rotation + rotationDifference; |
| | | |
| | | new TWEEDLE.Tween(sprite) |
| | | const rotationTween = new TWEEDLE.Tween(sprite) |
| | | .to({ rotation: endRotation }, ANIMATE_DURING_TIME) |
| | | .easing(TWEEDLE.Easing.Linear.None) |
| | | .onUpdate(() => { |
| | |
| | | } |
| | | }) |
| | | .start(); |
| | | data.rotationTween = rotationTween; |
| | | rotationTween.onComplete(() => { |
| | | if (data.rotationTween === rotationTween) { |
| | | data.rotationTween = null; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | export const incrementSpriteNo = (str, incrementValue) => { |
| | |
| | | |
| | | beInsight(agvSprite, setCurSprite); |
| | | |
| | | new TWEEDLE.Tween(agvSprite.position) |
| | | if (agvSprite.data.moveTween) { |
| | | agvSprite.data.moveTween.stop(); |
| | | agvSprite.data.moveTween = null; |
| | | } |
| | | |
| | | const moveTween = new TWEEDLE.Tween(agvSprite.position) |
| | | .to({ |
| | | x: codeSprite.position.x, |
| | | y: codeSprite.position.y |
| | | }, ANIMATE_DURING_TIME) |
| | | .easing(TWEEDLE.Easing.Linear.None) |
| | | .start(); |
| | | agvSprite.data.moveTween = moveTween; |
| | | moveTween.onComplete(() => { |
| | | if (agvSprite.data?.moveTween === moveTween) { |
| | | agvSprite.data.moveTween = null; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | const drawerAgvPath = (curZone, agvVo) => { |
| | |
| | | for (let i = mapContainer.children.length - 1; i >= 0; i--) { |
| | | const child = mapContainer.children[i]; |
| | | if (child?.data?.type === DEVICE_TYPE.AGV) { |
| | | if (child.data.moveTween) { |
| | | child.data.moveTween.stop(); |
| | | child.data.moveTween = null; |
| | | } |
| | | if (child.data.rotationTween) { |
| | | child.data.rotationTween.stop(); |
| | | child.data.rotationTween = null; |
| | | } |
| | | if (child.data.jobEffect) { |
| | | app?.ticker.remove(child.data.jobEffect._onTick); |
| | | child.removeChild(child.data.jobEffect); |
| | |
| | | .easing(TWEEDLE.Easing.Quadratic.Out) |
| | | .to(targetPos, 500) |
| | | .start(); |
| | | }; |
| | | }; |