TGViewer
./π‘³π’π’„π’‚π’•π’Šπ’π’ ./π‘³π’π’„π’‚π’•π’Šπ’π’ @locationexecuted Β· 2.04K subscribers
Post #2567 16

Forwarded from TenzXTeam (noryn.)

Animasi Spidey Web menggunakan JavaScript agar mengikuti gerakan mouse/cursor secara real-time. Hubungkan posisi cursor dengan sistem partikel dan objek laba-laba.
var spider = sim.spider(new Vec2(width / 2, -300));

spiderweb.drawParticles = function (ctx, composite) {
var i;

for (i in composite.particles) {
var point = composite.particles[i];

ctx.beginPath();
ctx.arc(
point.pos.x,
point.pos.y,
1.3,
0,
2 * Math.PI
);

ctx.fillStyle = "#7AAA";
ctx.fill();
}
};

Tambahkan kode berikut ke script.js. Kode ini merekam posisi cursor, memperhalus pergerakannya, dan menyediakan koordinat target yang dapat digunakan oleh sistem animasi Spidey Web.

const cursor = {
x: window.innerWidth / 2,
y: window.innerHeight / 2,
targetX: window.innerWidth / 2,
targetY: window.innerHeight / 2
};

// Ambil posisi mouse
window.addEventListener("mousemove", (event) => {
cursor.targetX = event.clientX;
cursor.targetY = event.clientY;
});

// Dukungan layar sentuh
window.addEventListener("touchmove", (event) => {
const touch = event.touches[0];

if (touch) {
cursor.targetX = touch.clientX;
cursor.targetY = touch.clientY;
}
}, { passive: true });

// Pergerakan yang lebih halus
function updateCursor() {
cursor.x += (cursor.targetX - cursor.x) * 0.12;
cursor.y += (cursor.targetY - cursor.y) * 0.12;

requestAnimationFrame(updateCursor);
}

updateCursor();
More from @locationexecuted
  1. Oct 11, 2026Sepelit itu kah dia😭
  2. Oct 11, 2026mulai dari 2023 jir bareng fakhri
  3. Oct 11, 2026u serius bang share semua di sini
  4. Oct 11, 2026berbagi ilmu itu indah ga kaya fakhri pelit
  5. Oct 11, 2026buat yg suka scanning burpsuite langsung aja tuh oprek2 script biar template lancar scan d…
  6. Oct 11, 2026document post
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’