help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%

Magnetic Button Effect

Physics • Mouse Following • Particles • Sounds • Config Panel — Interactive magnetic buttons with smooth attraction. Pure CSS & Vanilla JS. By rskworld.in.

Mouse Following Physics-Based Particle Effects 5 Particle Types Sound Effects Config Presets Performance Monitor Vanilla JS
Download Magnetic Button Effect Live Demo RSK View Files
Magnetic Button Effect - RSK World
Magnetic Button Effect - RSK World
Magnetic & Mouse Particles & Sounds Config & Presets Performance & Showcase Vanilla JS

Magnetic Button Effect is an interactive button demo with physics-based mouse attraction. Features: MagneticButton and MagneticButtonManager (script.js), strength/distance/smoothness controls, particle effects (sparkle, fire, ice, magic, toxic) via particles.js, Web Audio sound effects (sounds.js), configuration panel with presets (Gentle, Balanced, Powerful, Minimal, Playful), performance monitor, and advanced showcase (showcase.html) with 3D/liquid/neon/holo styles. Files: index.html, showcase.html, style.css, showcase.css, script.js, main.js, particles.js, sounds.js, config-panel.js, performance-monitor.js, showcase.js. By rskworld.in.

If you find this Magnetic Button Effect project useful, you can support with a small contribution.

Secure Fast Trusted
Pay via UPI QR
Scan or tap an amount to auto-generate
UPI QR
₹
Open UPI app
GPay PhonePe Paytm
Download Magnetic Button Effect

Magnetic Button & Physics

MagneticButton class in script.js: mouseenter/mouseleave and mousemove on wrapper. Force from wrapper center to cursor; within distance threshold, targetX/Y computed with (1 - distance/distance) * strength. Lerp current position toward target with smoothness; transform translate applied each frame. MagneticButtonManager initializes all .magnetic-btn and syncs strength/distance/smoothness sliders.

  • MagneticButton: element, wrapper, options (strength, distance, smoothness)
  • handleMouseMove: deltaX/deltaY, distance, force scaling
  • animate(): lerp currentX/Y to targetX/Y, requestAnimationFrame loop
  • Touch support: touchstart, touchend, touchmove mapped to mouse events

Project Structure & Files

magnetic-button/ with index.html (main demo), showcase.html (Basic, Advanced, Creative, Experimental sections), style.css and showcase.css, script.js (MagneticButton, MagneticButtonManager), main.js (MagneticButtonApp), particles.js, sounds.js, config-panel.js, performance-monitor.js, showcase.js. No build step. Open index.html or serve folder.

  • magnetic-button/ – index.html, showcase.html, style.css, script.js, main.js, particles.js, sounds.js, config-panel.js, performance-monitor.js, showcase.js, README.md
  • No build step – open index.html or static server
  • Font Awesome 6 (CDN) for icons
  • Zero dependencies; vanilla HTML, CSS, JavaScript

Config Panel & Presets

Configuration panel (config-panel.js): presets (Gentle, Balanced, Powerful, Minimal, Playful), sliders for strength/distance/smoothness, particle effect type, sound toggle and volume, hover/click scale, return duration, border radius, shadow and glow. Export/reset config. main.js wires configChanged and presetChanged to update buttons and toggles.

  • Presets: gentle, balanced, powerful, minimal, playful
  • ConfigurationPanel: createPanel(), applyPreset(), updateConfig()
  • CSS variables updated from config (--magnetic-strength, etc.)
  • updateControlsFromConfig() syncs main page sliders and checkboxes

Particles & Sounds

Particles (particles.js): ParticleSystem with canvas, stream on hover, gravity and life. MagneticParticleEffects: sparkle, fire, ice, magic, toxic with color palettes. Buttons use data-particles attribute. Sounds (sounds.js): Web Audio hover, click, attract, release, success, error, magic; SoundEffectsManager with enable/disable and volume.

  • ParticleSystem: burst(), stream(), createParticle(), animate() loop
  • Effect types: sparkle, fire, ice, magic, toxic (colorPalette per type)
  • SoundEffectsManager: createWhooshSound, createTapSound, createChimeSound, etc.
  • main.js: initializeParticleEffects(), playSound() on hover/click

Main App & Showcase

MagneticButtonApp (main.js) initializes MagneticButtonManager, initSoundEffects, initPerformanceMonitor, ConfigurationPanel, particle effects per data-particles, and button interactions (ripple, stats). ShowcaseManager (showcase.js) handles section nav, initializes all magnetic buttons and particle systems, playground for custom button, and export.

  • MagneticButtonApp: initializeComponents(), setupButtonInteractions(), setupControlSliders()
  • Keyboard shortcuts: Ctrl+, config, Ctrl+P performance, Ctrl+S sound, Ctrl+E export
  • Showcase: Basic, Advanced (particles), Creative (3D/liquid/neon/holo), Experimental
  • Playground: text, style, strength, distance, particle effect; updatePreviewButton()

What You Get

Static HTML/CSS/JS: magnetic-button/ folder with index.html, showcase.html, style.css, showcase.css, script.js, main.js, particles.js, sounds.js, config-panel.js, performance-monitor.js, showcase.js, README.md. No build step. Open index.html or serve folder.

  • Complete source – magnetic-button/ with HTML, CSS, JS
  • No build step – open index.html or static server
  • README.md included with API and usage
  • Technologies: HTML5, CSS3, Vanilla JS. © 2026 RSK World.

Usage

Open index.html. Move mouse near buttons to see magnetic attraction. Use sliders for strength, distance, smoothness; toggles for sound and particles. Configuration button opens panel with presets. Performance button shows FPS/score. showcase.html for advanced examples and playground.

  • magnetic-button/index.html – main page with controls and stats
  • script.js: MagneticButton, MagneticButtonManager
  • Accessibility: keyboard nav, screen reader friendly, touch support
  • Author: RSK World | rskworld.in

Project Features

Mouse-following magnetic buttons, physics-based movement, particle effects (sparkle, fire, ice, magic, toxic), Web Audio sounds, config panel with 5 presets, performance monitor, ripple on click, keyboard shortcuts, showcase with creative button styles (3D, liquid, neon, holographic, gravity, etc.).

  • Magnetic effect – strength, distance, smoothness, return animation
  • Config panel – presets, sliders, checkboxes, export/reset
  • Particles – canvas stream on hover, 5 effect types
  • Showcase – tabbed sections, playground, stats

Credits & Acknowledgments

Magnetic Button Effect by RSK World. Interactive magnetic buttons with physics-based mouse attraction, particle effects, and config panel for learning vanilla JS and UI design.

  • Magnetic Button Effect – magnetic attraction, particles, sounds, config
  • RSK World – Project creator and educational platform
  • Author: Molla Samser (Founder - RSK World)
  • Website: https://rskworld.in
  • Email: help@rskworld.in | +91 93305 39277
  • © 2026 RSK World. All rights reserved.

Support & Contact

For Magnetic Button Effect customization or integration help, please contact us.

  • Email: help@rskworld.in
  • Phone: +91 93305 39277
  • Website: RSKWORLD.in
  • Location: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India - 713147
  • Author: Molla Samser (Founder, RSK World)
  • Magnetic Button Effect - README
  • Technical Support Available
  • UI Component Requests Welcome
Featured Content
Additional Sponsored Content

Download Magnetic Button Effect

Get the complete Magnetic Button Effect project. You can view the files or download the source code directly.

Download Magnetic Button Effect

Quick Links

Live Demo - Run Magnetic Button Effect Click to explore
Download Magnetic Button Effect Click to explore
View Files (Browser) Click to explore
Explore All Creative Projects by RSK World Click to explore
Explore All Frontend & Layout Projects by RSK World Click to explore

Categories

Magnetic & Mouse Particles & Sounds Config & Presets Performance & Showcase Vanilla JS

Technologies

HTML5 & CSS3
Magnetic Effect
Responsive
Accessibility
Vanilla JS

Featured Projects

UI/UX & Magnetic Button Projects by RSK World

3D Transforms CSS Perspective JavaScript Animations Canvas API LocalStorage Particle Effects
React Button & Input Components - rskworld.in
React Button & Input Components
React UI

Reusable React button and input components with variants and hooks.

View Project
Image Slider with Thumbnails - rskworld.in
Image Slider with Thumbnails
JavaScript Demos

Advanced image slider with thumbnail navigation and autoplay.

View Project
3D Card Hover Effect - rskworld.in
3D Card Hover Effect
CSS UI Effects

Stunning 3D card hover effect with perspective transforms and smooth animations.

View Project
Micro UI Gallery - rskworld.in
Micro UI Gallery
Micro UI Components

A curated collection of reusable micro UI components built with HTML, CSS, and J...

View Project
CSS Neon Button Hover - rskworld.in
CSS Neon Button Hover
CSS UI Effects

Glowing hover effect using CSS box-shadow and transitions.

View Project
View All Projects

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer

Support This Free Project

This project is completely free to download!

If you find it useful, consider supporting us with a small donation. Your support helps us create more free projects.

Pay via Razorpay

If you find this Magnetic Button Effect project useful, you can support with a small contribution.

Secure Fast Trusted
Payment Successful! Your download will start automatically...
Pay via UPI QR
Scan or tap an amount to auto-generate
UPI QR
₹
Open UPI app
GPay PhonePe Paytm