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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


<!-- Elements -->
<div class="wrapper">  
  <div class="mouse"></div>
  <div class="random-elements">
    <div class="random one circle not-clicked"></div>
    <div class="random two circle not-clicked"></div>
    <div class="random three triangle not-clicked"></div>
    <div class="random four rectangle not-clicked"></div>
  <span class="trigger not-clicked">Click!</span>
<!-- My details -->
<h1>bleeding effect</h1>
<div class="profile">
  <img src="" alt="Profile Image" />
  <h3>Made by <a target="_blank" href="">Eslam nasser</a></h3>
    Another cool <a target="_blank" href="">SVG!</a>

<!-- SVG Filters -->
<svg xmlns="" version="1.1">
    <!--   This is where the magic happens   -->
    <filter id="sticky">
      <!--    Apply 10px blur    -->
      <feGaussianBlur in="SourceGraphic" stdDeviation="12" result="blured" />
      <!--   Increase the contrast of the alpha channel 
              Read this     -->
      <feColorMatrix in="blured" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="weirdNumbers" />
      <!--    Adding the two effects,
              Fix some bugs with "atop" -->
      <feComposite in="SourceGraphic" in2="weirdNumbers" operator="atop"/>

              // Some general stuff
@import '|Roboto+Condensed'
body, html
  cursor: none
  overflow: hidden
    color: #34495e
    image: url('')
  font-family: 'Poiret One', cursive

// Pen Details
  text-align: center
  color: #FFF
  position: relative
  z-index: 3
  text-transform: uppercase
    weight: 100
    size: 60px
  position: absolute
  width: 30%
  bottom: 20px
  left: 50%
  margin-left: -15%
  z-index: 3
    width: 20%
    border-radius: 100%
    float: left
    margin: auto 5%
  h3, p
    width: 70%
    float: left
    color: #FFF
    padding: 0
    margin-bottom: 0
      size: 22px
    margin-top: 5px
    color: #FFF

// Vars
$elements_color: #e74c3c
$elements_shadow:  none // Add shadow if you want 0px 2px 5px 0px rgba(0,0,0,0.16),0px 2px 5px 0px rgba(0,0,0,0.23)

// Must apply the svg filter to the parent
  filter: url('#sticky') // The id of the filter
  position: absolute
  top: 0
  right: 0
  left: 0
  bottom: 0
  width: 100%
  height: 100%
  z-index: 3
    position: absolute
    display: block
    width: 100px
    color: #FFF
    text-transform: uppercase
    top: 48%
    left: 50%
    margin-left: -50px
    text-align: center
    font-size: 25px

// Mouse
  width: 60px
  height: 60px
  border-radius: 100%
  background: $elements_color
  box-shadow: $elements_shadow
  will-change: transform // Read this

  width: 100px
  height: 100px
  margin: 100px
  background: $elements_color
  box-shadow: $elements_shadow
  position: absolute
  top: 50%
  left: 50%
  margin-left: -50px
  margin-top: -50px
  transition: 4s
  transform: translate3d(0,0,0)
  transform-origin: center center
  will-change: transform, transition // Read this
  border-radius: 100%
  width: 0
  height: 0
  background: transparent
  border-left: 50px solid transparent
  border-right: 50px solid transparent
  border-bottom: 100px solid $elements_color
  box-shadow: none
              // Trace the mouse
// Some vars to start with
var mouse     = $('.mouse'),
    currentX  = 0, 
    currentY  = 0,
    newX      = 0, 
    newY      = 0;

// Get X and Y positions
   currentX = e.pageX; // Get the mouse X position
   currentY = e.pageY; // Get the mouse Y position
// Make the trace a little bit smooth
var fps = setInterval(function(){
      newX += (currentX - newX) / 5; // Create new X position
      newY += (currentY - newY) / 5; // Create new Y position
        'transform': 'translate3d('+(newX - 30)+'px, '+(newY - 30)+'px, 0)' // ALWAYS use transform property to get the best performance
      // console.log('My current Y location is (' +newY+ ') and in X is ('+newX+')' )
  }, 16);// Refresh the positions each 16ms to get ~60fps

// Moving the elements randomly functions

// Trigger the movement
$('.random.not-clicked, .trigger.not-clicked').click(function(){
function makeNewPosition(){
    // All this vars to generate different values for each element
    var windowHeight  = ( $(window).height() - ( $(window).height() / 2 ) ),
        windowWidth   = ( $(window).width() - ( $(window).width() / 2 ) ),
        randomHeight1 = Math.floor(Math.random() * windowHeight),
        randomHeight2 = Math.floor(Math.random() * windowHeight),
        randomHeight3 = Math.floor(Math.random() * windowHeight),
        randomHeight4 = Math.floor(Math.random() * windowHeight),
        randomWidth1  = Math.floor(Math.random() * windowWidth),
        randomWidth2  = Math.floor(Math.random() * windowWidth),
        randomWidth3  = Math.floor(Math.random() * windowWidth),
        randomWidth4  = Math.floor(Math.random() * windowWidth);

  return [randomHeight1, randomHeight2, randomHeight3, randomHeight4, randomWidth1, randomWidth2, randomWidth3, randomWidth4];    

function movingElements(){
  var newq = makeNewPosition();
  $('').css({'transform': 'translate3d('+newq[4]+'px,-'+newq[0]+'px, 0)'});
  $('.random.two').css({'transform': 'translate3d(-'+newq[1]+'px,'+newq[5]+'px, 0)'});
  $('.random.three').css({'transform': 'translate3d('+newq[6]+'px,-'+newq[2]+'px, 0)'});
  $('.random.four').css({'transform': 'translate3d(-'+newq[3]+'px,'+newq[7]+'px, 0)'});
  setTimeout( function() {
  }, 3000);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.