Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fade out circle layer from center jQuery/GSOP

I have created two layer div, one with background image and another with a black layer which is fading out, seems to okay but the requirement is a bit different, the fade out layer should start from center (circle), as per the example below:

example fade out from center position

This is what I have created, JSfiddle Demo

Can anybody please suggest how to get achieve that circle type centered fadeout, instead that the one which I have created? I have used greensock in my project.

Please suggest

$(document).ready(function() {
  var videoFade = $(".fade-layer");
  TweenMax.to(videoFade, 14, { x:0 , opacity:0 , ease:Power1.easeInOut ,repeat:-1  });
});
.layer-one{
  background:url(https://i.imgsafe.org/90203acca5.jpg); 
  background-size:cover; 
  background-position:center; 
  position:absolute; 
  left:0; 
  top:0; 
  width:100%; 
  height:100%; 
  z-index:1;
}
.fade-layer{
  background:rgba(0,0,0,1); 
  position:absolute; 
  left:0; 
  top:0; 
  width:100%; 
  height:100%; 
  z-index:2;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.1/TweenMax.min.js"></script>
<div class="layer-one"></div>
<div class="fade-layer"></div>
like image 761
Sanjeev Kumar Avatar asked Dec 18 '25 00:12

Sanjeev Kumar


1 Answers

I've not really worked with GASP but I was able to create a quick demo what you have to do with box-shadow. You can achieve what you are trying to do with that. Check this fiddle: https://jsfiddle.net/1uzj2v5L/4/

$(document).ready(function() {
var videoFade = $(".fade-layer");
    TweenMax.to(videoFade, 5, { x:0 , opacity:0.5 , ease:Power1.easeInOut ,repeat:-1,
    boxShadow:"0px 0px 0px 0px rgb(0,0,0) inset;"});

  });
like image 140
mehulmpt Avatar answered Dec 20 '25 19:12

mehulmpt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!