Jump to content
Search Community

Background parallax effect on mouse move

Ahsan Jamal
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Posted

I am trying to create a website using the background effect exactly similar as implemented in this website, http://brightmedia.pl/ . On inspect element the div that creating the parallax effect on background from mouse move and scroll as well, we can see that it is changing the translate3D() property of the element on mouse move. Please guide me how can I achieve this same background effect?

Posted

Here is very basic demo.  You can change movement based on element you are animating.

 

You can also use parallax.js which responds to gyroscope on mobile devices.

 

See the Pen OxeeNV by Sahil89 (@Sahil89) on CodePen.

 

  • Like 10
  • Thanks 1
Posted

@OSUblake I thought you will have some corrections or different approach. :-D

 

One question, in case I try to implement parallax effect to respond to gyroscope, what entire set up is going to be? No, I am not going to actually do it, I would rather use parallax.js but curious about how you can implement/test such device specific effects.

 

Edit: it can be emulated on chrome.

Posted

@Sahil there are I think two backgrounds running in this site  http://brightmedia.pl/ . I think one background is fixed and one background is moving which is showing the effect. Can we use this code to create a similar effect like in this site ? Also can you please explain gyroscope concept ?

Posted

Ya you can have multiple elements with different movement, which creates this effect. They all are probably reacting to same event with different movements. You can create similar effect by setting different movement. I have updated demo with two elements.

 

About gyroscope, you must have seen 360 video on mobile. By using parallax.js you can have same movement as we move mouse whenever user physically moves the mobile.

Posted

Here is demo with delay before parallax effect happens. You can play with movement, timeout and ease effects to see what works best for you.

 

See the Pen wrVEOj by Sahil89 (@Sahil89) on CodePen.

 

  • Like 4
  • Thanks 2
Posted

Thankyou so much @Sahil this really helped me implementing the effect. Thankyou :)

 

  • Like 2
  • 10 months later...
  • 3 months later...
Posted
On 10/26/2017 at 3:36 PM, Sahil said:

Here is demo with delay before parallax effect happens. You can play with movement, timeout and ease effects to see what works best for you.

 

See the Pen wrVEOj by Sahil89 (@Sahil89) on CodePen.

 

 

 

Can you please give me some code for this  http://brightmedia.pl/

i was wondering what was the code he is using for the line..

 

Please help me. 

Thank you

Posted

Hi Wyne,

 

welcome to the GreenSock forums.

 

If you open up Dev Tools and inspect the site you will see that the majority of the fancy background visuals are rendered using HTML5 canvas

 

Screen Shot on 2018-12-27 at 09-50-35.png

 

You can also go to the network tab in dev tools and look at the source of this js: http://brightmedia.pl/js/main.min.js Dev tools will make it pretty / readable.

Even with the code readable it could take quite some time to reverse-engineer what they are doing.

 

If you are not familiar with canvas, I would strongly suggest you use DrawSVGPlugin which makes it SUPER easy to reveal SVG strokes in a wide variety of ways

 

https://greensock.com/drawSVG

 

 

 

  • Like 3
  • 6 months later...
Posted

Hi Sahil,

 

How could this work for multiple images?

ZachSaucier
Posted

@Gumbo I don't understand your question. The demo above works on multiple elements (the image and the .slide element) already. 

 

Do you mean how can you have multiple sections, each with this type of behavior? Or do you mean something else? A minimal demo or at least a picture would help us be able to help you :) 

  • Like 1
ZachSaucier
Posted

You can just add more elements to your HTML and call parallaxIt on them from callParallax like so:

 

See the Pen OeqgrZ by GreenSock (@GreenSock) on CodePen.

  • Like 2
Posted

But instead of using classes, can you not just call different img?

ZachSaucier
Posted
20 minutes ago, Gumbo said:

But instead of using classes, can you not just call different img?

 

Sure you can. But you need to be able to select it somehow. Why don't you try editing the demo to reproduce whatever you're imagining and then posting that demo here so that we can give you feedback?

  • Like 4
  • 1 month later...
Posted

Hello guys,

 

Just wondering how to make such a nice animation having the same effect as here https://godofwar.playstation.com/ . When moving mouse right left or up and down, it seems as the images, especially the background image behaves slightly different than in those examples here in the discussion. Plus there is the cloud and snow animation integrated.

I found it here, its number 17:  https://www.creativebloq.com/inspiration/css-animation-examples/2

they also have a link to the code with hmtl and css, I have tried that code but the code does not include any of those effects.

 

Anyone an idea how that has been made? I really wish to have the same effect, of course with different photos.

 

Posted

Hey coderon and welcome to the forums,

 

12 hours ago, coderon said:

Anyone an idea how that has been made?

It's made using WebGL and the same basic technique as the one in this thread. It looks like they are also applying some perspective to the transition. So essentially they are a little zoomed in with the "camera" or viewpoint and use a 3D "turn" as opposed to the 2D sliding that's going on in this thread. Same principles, an additional dimension. 

 

Does that make sense? 

  • Like 4
Posted

Ah I see, thank you for the explanation.

 

Its a very nice effect and worth to use it for own website. Im not thtat expert so need to learn first ^^

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...