const canvas = document.getElementById(‘canvas-raios’);
const ctx = canvas.getContext(‘2d’);
const container = document.getElementById(‘container-eletrico’);
const img = document.getElementById(‘img-servidor’);
function resize() {
canvas.width = container.offsetWidth;
canvas.height = container.offsetHeight;
}
// Garante que o canvas tenha o tamanho da imagem após ela carregar
img.onload = resize;
window.addEventListener(‘resize’, resize);
if (img.complete) resize();
container.addEventListener(‘mousemove’, (e) => {
const rect = container.getBoundingClientRect();
const x = e.clientX – rect.left;
const y = e.clientY – rect.top;
drawLightning(x, y);
});
function drawLightning(x, y) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = ‘#4deeea’; // Ciano elétrico
ctx.lineWidth = 1.5;
ctx.shadowBlur = 15;
ctx.shadowColor = ‘#00f2ff’;
for (let i = 0; i < 3; i++) {
ctx.beginPath();
ctx.moveTo(x, y);
let curX = x;
let curY = y;
for (let j = 0; j ctx.clearRect(0, 0, canvas.width, canvas.height), 80);
}
container.addEventListener(‘mouseleave’, () => ctx.clearRect(0, 0, canvas.width, canvas.height));
alert(‘JS funcionando!’);
PROJETO GAMMA
Pesquisa avançada em algoritmos paralelos para processamento de dados massivos e sistemas de missão crítica.
This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.