Frosted and see-through circular background effect triggered by mouse movement

I've been attempting to duplicate the mesmerizing effect showcased on this webpage: (give it a try by moving your mouse), but I'm baffled by how they managed to achieve it?

My attempts at experimenting with a JSFiddle can be found here: http://jsfiddle.net/1tz5b6r0/, however, the results have been less than successful.

The following function:

 function animate() {
   requestAnimationFrame(animate);

   update();
 }

Makes use of requestAnimationFrame, yet there is no trace of it in their codebase.

The method behind creating this particular effect eludes me

What am I overlooking?

Answer №1

That's an impressive effect! I decided to give it a go myself: http://jsfiddle.net/wLa4cLay/

  • As you move the mouse, a fuzzy circle forms at its position
  • Color and size are randomly generated
  • The circle shrinks and fades out quickly
  • The blur effect is achieved using a box shadow

    /* Generate an animated circle with every mouse movement */ $('body').on('mousemove', function(ev) { createRandomCircle(ev.pageX, ev.pageY); });

    function createRandomCircle(x, y) {

    /* Adjust for 100px top offset in shadow */
    y = y -100;
    
    /* Generate a random color */
    var colorR = Math.ceil(Math.random() * 255);
    var colorG = Math.ceil(Math.random() * 255);
    var colorB = Math.ceil(Math.random() * 255);
    var color = 'rgb('+colorR+','+colorG+','+colorB+')';
    
    /* Generate a random size */
    var size = Math.ceil(Math.random() * 80);
    
    /* Create the circle */
    var circle = $('<span />')
        .addClass('circle')
        .css('left', x+"px")
        .css('top', y+"px")
        .css('width', size+"px")
        .css('height', size+"px")    
        .css('color', color)
        .css('box-shadow', '0px 100px 40px')
        .css('border-radius', '80px');
    
    circle.appendTo('body');
    
    /* Animate the circle (shrink and fade out) */  
    circle.animate({opacity: 0, width: '10px', height: '10px'}, 500, function() {
        /* Remove it once the animation is complete */
        $(this).remove();
    });
    

    }

Styles:

html, body {
    height: 100%;
}

.circle {
  display: block;
  position:absolute;
  background-color: transparent;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Top scroll button malfunctioning on this page

Updated question for better understanding. In my current project, let's imagine I am on the following URL: http://127.0.0.1:8000/blog/ and within that page I have the following HTML: <a href="#top">Back to top</a> Upon hovering over tha ...

Show the div on top of all other elements

I need help implementing a multi-select feature with checkboxes as options. Unfortunately, the issue arises when the div containing the options causes other elements on the same row to resize. This is my current code: <html> <head> ...

form submission issue with return false not working

Despite my efforts, the form still redirects to the page. I've been awake since 1AM trying to troubleshoot this issue! Please assist! function del_entry() { $('.delete_deal').submit(function() { var $g = $(this); ...

Tips for changing input field type from "password" to "text" in Angular?

Is there a way to dynamically convert an input field with type="password" to type="text" in Angular? In my demo, I have two input fields labeled Mobile no and Re-enter mobile number. I want these fields to change to type="text" if the user inputs the same ...

The event listener for 'load' is not functioning properly within the React (Gatsby) environment

I'm having trouble with a sticky scroll parallax effect when the page initially loads at a position other than the top. I'm utilizing the react-scroll-parallax library (https://www.npmjs.com/package/react-scroll-parallax). To address this issue, ...

Solutions for resolving the issue of not being able to load images when using merged-images in JavaScript

I have a base64 image here and it has already been converted. data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQSEhUTEhQWFhUXGBoaGBgYGBcXGhgXGBgYGhgbHhoZHiggGholHhgYITEhJSkrLi4uHR8zODMtNygtLisBCgoKDg0OGhAQGi0lICUtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0 ...

passing arguments during deferred resolve() and when() operations

I am currently working on a flash card website and I need to determine the status of preloaded images once they have finished loading or if there was an error. After obtaining the status of each image, I will proceed with further actions. My code is inspi ...

What is the most efficient way to enable seamless communication between sibling components in Vue.js 2?

Just starting out with Vue.js 2 and I'm really enjoying it so far despite being new to it. Currently using the latest version. I've begun working on my first larger application and ran into a scenario right off the bat where I have a main app co ...

Encountering an issue: The API call for /api/orders was resolved but no response was sent, potentially causing requests to become stuck in Next.js

Struggling with an error while working on an ecommerce website using Next.js. The error message reads: error: API resolved without sending a response for /api/orders, this may result in stalled requests The error also indicates: API handler should not ...

Emotion, material-ui, and typescript may lead to excessively deep type instantiation that could potentially be infinite

I encountered an issue when styling a component imported from the Material-UI library using the styled API (@emotion/styled). Error:(19, 5) TS2589: Type instantiation is excessively deep and possibly infinite. Despite attempting to downgrade to typescript ...

Unable to invoke Kendo JavaScript

I'm facing an issue with my source code where I am trying to call kendo.all.min.js. Everything works fine when I call kendo.common.min.css and kendo.default.min.css, but as soon as I try to call kendo.all.min.js, I encounter the following error: http ...

Expanding functionality: Steps to integrating a new endpoint into your AWS Amplify Express Server

I have created a REST express server using Amplify. Attempted to include two additional endpoints: // incorporating serverless express app.post('/myendpoint', function(req, res) { console.log('body: ', req.body) res.json(req.body) ...

What could be the reason my SVG images are not displaying?

My website contains SVGs that are not loading consistently. I acquired some from freeicons/icon8 and created a couple using Inkscape. Initially, I inserted them using HTML but switched to CSS after doing research online on how to ensure they load properly ...

Calculating interest rates in Javascript: A guide to determining values using two separate rates

I am currently working on an earnings calculator function EarningsCalculator.prototype.calculateEarning = function (interestRate, investmentAmount) { var earningHistory = {}; var currentInvestment = investmentAmount; for (var year = 1; year & ...

Unable to modify the appearance of text on the canvas

Trying to customize the font style of canvas text with Press Start 2P The URL has been imported into a CSS file as follows: @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap'); .canvasClass{ font-family: ...

Adding items to an array within a jQuery each loop and performing a jQuery ajax request

I am trying to loop through an array, push the results into a JavaScript array, and then access the data outside of each loop and AJAX call. Can anyone explain how to do this? This is what I have attempted: var ides = ["2254365", "2255017", "2254288", ...

The dataset controller in Chart.js returns 'null' when the chart is rendered

Greetings, I must preface this by saying that I am not well-versed in javascript/web development and do not claim to have a strong understanding of the language or its environment. My expertise lies in embedded C/C++ programming, and my foray into learning ...

What could be the reason for event.stopPropagation() not functioning properly with a switch statement

Could you please explain why the function event.stopPropagation() is not working on the switch element? Whenever I click on the switch, it prints the console log for the switch. However, when I click on the surrounding area (row), it logs the row event in ...

Tips for updating and transferring a variable within a callback function

I have implemented a function using the SoundCloud API that retrieves a song URL, obtains the associated sound ID from the API, and then passes that ID to a callback for streaming purposes and updating the page. The data is successfully retrieved from the ...

Troubleshooting the ckeditor-duplicated-modules error when trying to install a local npm package that should utilize the node_modules of the main project through yarn

As I work on my MainProject, I'm attempting to set up a local version of the ckeditor-5 plugin PeteCkPlugin that was generated using the ckeditor5 package generator. I experimented with using yarn link within the local directory of PeteCkPlugin, foll ...