cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div id="cursor"><span></span></div>
<div class="c-portrait c-portrait__one">
<svg width="100%" height="100%">
  <defs>
    <clipPath id="clipping-one">
        <rect class="c-mask__one c-mask" x="40%" y="30%" width="40%" height="50%"/>
    </clipPath>
  </defs>
</svg>
</div>

<div class="c-portrait c-portrait__two">
<svg width="100%" height="100%">
  <defs>
    <clipPath id="clipping-two">
        <rect class="c-mask__two c-mask" x="15%" y="15%" width="50%" height="30%"/>
    </clipPath>
  </defs>
</svg>
</div>

<div class="c-portrait c-portrait__three">
<svg width="100%" height="100%">
  <defs>
    <clipPath id="clipping-three">
        <rect class="c-mask__three c-mask" x="52%" y="60%" width="40%" height="30%"/>
    </clipPath>
  </defs>
</svg>
</div>
            
          
!
            
              @import 'https://fonts.googleapis.com/css?family=Lato:400,400i,900,900i';
.txt__normal     { font-family: 'Lato', sans-serif; font-weight: 400; }
.txt__normal--it { .txt__normal; font-style: italic; }
.txt__bold       { font-family: 'Lato', sans-serif; font-weight: 900; }
.txt__bold--it   { .txt__bold; font-style: italic; }

//html * {  border: inset 1px red; }

/* VARIABLES ================================================*/

@col__black: #000000;
@col__white: #ffffff;

@sz__small: 14px;
@sz__medium: 18px;
@sz__large: 28px;

@mr__small: 20px;
@mr__medium: 30px;
@mr__large: 50px;

/* ===========================================================*/
body {  
  height: 100%; 
  cursor: none;
}

#cursor {
  position: absolute;
  z-index: 1000; 
  width: 30px;
  height: 30px;
  background-color: @col__white;
  opacity: 0;
  .u-border-radius(50%);
  &.isVisible {
    opacity: .2;
  }
  span {
    display: block;
    width: 100%;
    height: 100%;
    padding: 2px;
    border: solid 1px @col__white;
    opacity: .5;
    .u-border-box;
    .u-transform(scale(1.4));
    .u-border-radius(50%);
  }
}

html {
  background: @col__black;
  height: 100%;
  color: @col__white;
  .txt__normal;
}

.wrapper {
  position: relative;
  max-width: 1024px;
  width: 100%;
  margin: 0 auto;
}

.c-portrait {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
.c-mask {
  -webkit-transition: -webkit-transform .5s;
  -moz-transition: -moz-transform .5s;
  -ms-transition: -ms-transform .5s;
  transition: transform .5s;
}

.c-portrait__one {
  background-image: url('http://moonlight.movie/assets/images/header/main01.jpg');
  clip-path: url(#clipping-one);
}

.c-portrait__two {
  background-image: url('http://moonlight.movie/assets/images/header/main02.jpg');
  clip-path: url(#clipping-two);
}

.c-portrait__three {
  background-image: url('http://moonlight.movie/assets/images/header/main03.jpg');
  clip-path: url(#clipping-three);
}
/* UTILITY ===========================================================*/

//border box
.u-border-box {
    box-sizing        : border-box;
    -moz-box-sizing   : border-box;
    -webkit-box-sizing: border-box;
}
// transform
.u-transform (@handler) {
    transform        : @handler;
    -webkit-transform: @handler;
}
// horizontal center
.u-horizontal-center (@mleft) {
    left       : 50%;
    margin-left: @mleft;
}
// border radius
.u-border-radius (@radius) {
    border-radius        : @radius;
    -webkit-border-radius: @radius;
}
// shadow
.u-shadow (@shadow-h: 0, @shadow-v: 0, @shadow-b: 10px, @shadow-s: 0, @shadow-col: fade(@col__black, 30%)) {
    box-shadow        : @shadow-h @shadow-v @shadow-b @shadow-s @shadow-col;
    -webkit-box-shadow: @shadow-h @shadow-v @shadow-b @shadow-s @shadow-col;
}
// float elements
.u-clearfix {
    &:after {
        content: '';
        display: block;
        float  : none;
        clear  : both;
    }
}
            
          
!
            
              
//--------------------
//global variables
//--------------------
var maskOne = $('.c-mask__one');
var maskTwo = $('.c-mask__two');
var maskThree = $('.c-mask__three');

//--------------------
//global functions
//--------------------
function moveMask(event, maskEl, operX, operY) {
  //var e = window.event;
  var winX = $(window).innerWidth()/2;
  var winY = $(window).innerHeight()/2;
  var posX = ((event.pageX - winX)/ operX).toFixed(0);
  var posY = ((event.pageY - winY)/ operY).toFixed(0);
  maskEl.css({
    transform: 'translate('+posX+'px, '+posY+'px)',
    '-webkit-transform': 'translate('+posX+'px, '+posY+'px)',
    '-moz-transform': 'translate('+posX+'px, '+posY+'px)',
    '-ms-transform': 'translate('+posX+'px, '+posY+'px)',
  });
};
function resetPos(maskEl) {
  maskEl.css({
    transform: 'translate(0, 0)',
    '-webkit-transform': 'translate(0, 0)',
    '-moz-transform': 'translate(0, 0)',
    '-ms-transform': 'translate(0, 0)',
  });
};
$(document,window,'html').mouseleave(function(event){
  $('#cursor').removeClass('isVisible');
}).mouseenter(function(){
  $('#cursor').addClass('isVisible');
  $(this).on('mousemove', function(event){
    //var e = window.event;
    var posX = event.pageX;
    var posY = event.pageY;
    $('#cursor').css({
      transform: 'translate('+posX+'px, '+posY+'px)',
      '-webkit-transform': 'translate('+posX+'px, '+posY+'px)',
      '-moz-transform': 'translate('+posX+'px, '+posY+'px)',
      '-ms-transform': 'translate('+posX+'px, '+posY+'px)',
    });
  });
});

//--------------------
//launch functions
//--------------------
$(document,window,'html').on('mousemove', function(event){
  setTimeout(
    moveMask(event, maskOne, 4, 4)
    ,1600);
}).mouseleave(function() {
  resetPos(maskOne);
});

$(document,window,'html').on('mousemove', function(event){
  setTimeout(
    moveMask(event, maskTwo, 8, 4)
    ,2800);
}).mouseleave(function() {
  resetPos(maskTwo);
});

$(document,window,'html').on('mousemove', function(event){
  setTimeout(
    moveMask(event, maskThree, 8, 4)
    ,500);
}).mouseleave(function() {
  resetPos(maskThree);
});

            
          
!
999px
Loading ..................

Console