Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <input id="blur-on" type="checkbox" checked /><label for="blur-on"> Motion Blur</label> <br />
<input id="image-on" name="mode" type="radio" /><label for="image-on"> Use Image</label> 
<input id="text-on" name="mode" type="radio" checked /><label for="text-on"> Use Text</label>

<div class="object">
  <div class="blur-outer">
    <div class="blur-inner">
      <span class="test-text"><span class="small">Motion</span> <br/> Blur</span>
      <img class="test-image" src="http://lorempixel.com/200/200" alt="" />
    </div>
  </div>
</div>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
      <filter id="blur">
          <feGaussianBlur id="blur-filter" in="SourceGraphic" stdDeviation="12,0" />
      </filter>
  </defs>
</svg>
              
            
!

CSS

              
                
debug=false

svg
  display none

body
  background black
  font-size 14px
  font-weight bold
  color white
  overflow hidden

.object
  position absolute
  left 40%
  top 40%
  text-transform uppercase
  padding 20px
  font-size 80px
  if debug
      background rgba(255,0,0,0.2)

#blur-on:checked~.object>.blur-outer
  filter url('#blur')

.test-image
  display none

#image-on:checked~.object 
  .test-image
    display block
  .test-text
    display none

.blur-outer
  transform-origin 50% 50%
  if debug
    background rgba(0,255,0,0.2)
  
.blur-inner
  transform-origin 50% 50%
  animation text-gfx-anim 3s 
  animation-fill-mode forwards
  if debug
    background rgba(0,0,255,0.2)

.small
  font-size 0.69em

input
  margin 10px
              
            
!

JS

              
                
$(document).ready(function(){
  var $obj=$(".object")
    ,$outer=$obj.children(".blur-outer")
    ,$inner=$outer.children(".blur-inner")
    ,blur=$("#blur-filter").get(0)
  ;
  
  function setBlur(v){
    blur.setAttribute("stdDeviation", v);
  }
  function setMotionBlur(angle,dist){
    TweenMax.set($outer,{
      rotation:angle+"rad",
      force3D:true
    })
    TweenMax.set($inner,{
      rotation:-angle+"rad",
      force3D:true
    })
    setBlur(dist+",0");
  }
  
  function anim(){
    TweenMax.to($obj,0.2+(Math.random()*0.4),{
      x:((Math.random()*200)-100)+"%",
      y:((Math.random()*200)-100)+"%",
      ease:Back.easeOut,
      onComplete:anim
    })
  }
  anim();
  
  function getPos(){
    return $obj.position();
  }
  var lastPos=getPos();
  
  function update(){
    var pos=getPos();
    var dx=pos.left-lastPos.left;
    var dy=pos.top-lastPos.top;
    var speed=Math.sqrt((dx*dx)+(dy*dy));
    var angle=Math.atan2(dy,dx);
    setMotionBlur(angle,speed);
    
    //setBlur(speed+","+0);
    
    lastPos=pos;requestAnimationFrame(update);
  }
  update();
})
              
            
!
999px

Console