Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
galtay committed Sep 5, 2024
1 parent 0a6d0a1 commit 2425032
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions circuit-board.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ class CircuitBoard extends HTMLElement {
this.render();
}

connectedCallback() {
this.updateRotation();
}

updateRotation() {
const rotation = this.getAttribute('rotation') || '0';
const circuitBoard = this.shadowRoot.querySelector('.circuit-board');
if (circuitBoard) {
circuitBoard.style.transform = `rotate(${rotation}deg)`;
}
}

render() {
this.shadowRoot.innerHTML = `
<style>
Expand All @@ -17,6 +29,7 @@ class CircuitBoard extends HTMLElement {
width: 100%;
height: 100%;
position: relative;
transition: transform 0.3s ease;
}
.line {
position: absolute;
Expand Down Expand Up @@ -67,6 +80,7 @@ class CircuitBoard extends HTMLElement {
${this.generateIntersections(7)}
</div>
`;
this.updateRotation();
}

generateLines(direction, count) {
Expand Down

0 comments on commit 2425032

Please sign in to comment.