oxidecomputer / design-site

We are looking for designers who code to help build a new user experience for computing!
https://design.oxide.computer
MIT License
98 stars 34 forks source link

Animate SVG with custom properties #9

Closed camwiegert closed 4 years ago

camwiegert commented 4 years ago

This removes the circuit.js script in favor of an inline script that only sets the path length as a custom property. It then uses CSS to orchestrate the animation using that property.

<script>
    const lines = document.querySelector('#lines').children;
    [...lines].forEach(line => {
        line.style.setProperty('--length', line.getTotalLength());
    });
</script>

I also narrowed the content so it would collide less with the circuits.

Hope this helps! 👍

jessfraz commented 4 years ago

this is awesome, thanks! So I kinda liked that the points of the wire were shown first then the wires appeared, which gives it more of a circuit feel, is there a way to do that? wdyt

camwiegert commented 4 years ago

For sure! Just had to adjust the timing a bit.

jessfraz commented 4 years ago

Awesome, that's dope thanks!