cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <link href='http://fonts.googleapis.com/css?family=Raleway:400,300' rel='stylesheet' type='text/css'>
<div class="container clearfix">
   <div class="avatar">
     <input id="fileUpload" type="file" />
      <svg version="1.1" id="camera" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
         viewBox="0 0 25 15" enable-background="new 0 0 25 15" xml:space="preserve">
      <path id="cameraFrame" fill="none" stroke="white" stroke-miterlimit="10" d="M23.1,14.1H1.9c-0.6,0-1-0.4-1-1V1.9c0-0.6,0.4-1,1-1h21.2
         c0.6,0,1,0.4,1,1v11.3C24.1,13.7,23.7,14.1,23.1,14.1z"/>
      <path id="circle" fill="none" stroke="#ffffff" stroke-width="1.4" stroke-miterlimit="12" d="M17.7,7.5c0-2.8-2.3-5.2-5.2-5.2S7.3,4.7,7.3,7.5s2.3,5.2,5.2,5.2
         S17.7,10.3,17.7,7.5z"/>
      <g id="plus">
         <path fill="none" id="plusLine" class="line" stroke="#ffffff" stroke-linecap="round" stroke-miterlimit="10" d="M20.9,2.3v4.4"/>
         <path fill="none" class="line"stroke="#ffffff" stroke-linecap="round" stroke-miterlimit="10" d="M18.7,4.6h4.4"/>
      </g>
     </svg>
     <div id="openModal">
       <span>Drop here or</span>
     </div>
      </div
   </div>
        <div class="right">
          <p>Mike</p>
          <p>Miller</p>
          <p>France</p>
        </div>
</div>
<p class="src">Photo source: Shutterstock<p>
            
          
!
            
              $blue: #2B2F3F
$pinkish: #C68587
$reddish: #BA4773

html 
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/176026/noise.png)
  background-color: #fff
  
.avatar
  float: left
  display: inline-block
  overflow: hidden
  width: 10vw
  height: 10vw
  border-radius: 100%
  background: $pinkish
  border: 6px solid #B3C9CB
  background-image: url(https://scontent-vie1-1.cdninstagram.com/hphotos-ash/t51.2885-19/10932224_821299211264682_1488190390_a.jpg)
  background-size: cover
  background-position: 50% 25%
  -webkit-transition: border 0.5s linear
  -moz-transition: border 0.5s linear
  -o-transition: border 0.5s linear
  transition: border 0.5s linear
    
  &:after
    content: ""
    position: absolute
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,rgba(240,227,199,1)), color-stop(100%,rgba(107,202,180,1)))
    width: 10vw
    height: 10vw
    border-radius: 100%
    border: 1px solid white
    left: 4px
    top: 4px
    opacity: 0
    -webkit-transition: opacity 0.3s linear
    -moz-transition: opacity 0.3s linear
    -o-transition: opacity 0.3s linear
    transition: opacity 0.3s linear
    cursor: pointer
    -webkit-transform-style: preserve-3d
      
.avatar:hover:after
  opacity: 0.7
.avatar.open:hover:after
  opacity: 0
.container
  text-align: center
  left: 50%
  -webkit-transform: translate3d(-50%,-50%,0)
  -moz-transition: translate3d(-50%,-50%,0)
  -o-transition: translate3d(-50%,-50%,0)
  transition: translate3d(-50%,-50%,0)
  position: absolute
  top: 50%
#camera
  -webkit-transform: scale(0.4)
  position: relative
  z-index: 9999
  cursor: pointer
  top: 18%
  overflow: hidden

#circle
  -webkit-transform: scale(0.75)
  -webkit-transform-origin: 50% 50%
  -webkit-transition: all 0.3s linear
  stroke-dashoffset: 33px
  stroke-dasharray: 33px
#cameraFrame
  -webkit-transition: all 0.5s linear
  stroke-dashoffset: 72px
  stroke-dasharray: 72px
#plus
  -webkit-transition: all 0.3s linear
  stroke-dashoffset: 5px
  stroke-dasharray: 5px
  
#fileUpload
  overflow: hidden
  position: absolute
  width: 70px
  padding: 10px
  opacity: 0
  left: 50%
  top: 70%
  -webkit-transform: translate3d(-50%,-50%,0)
  z-index: 9999
  -webkit-transition: 250ms cubic-bezier(.7,0,.36,1)
  transition: 250ms cubic-bezier(.7,0,.36,1)
  &:focus
    outline: none
    background: transparent
#openModal   
  width: 100%
  height: 100%
  position: absolute
  left: 0
  top: 0
  border-radius: 100%
  -webkit-transform: scale(0)
  z-index: 8888
  -webkit-transition: 250ms cubic-bezier(.7,0,.36,1)
  transition: 250ms cubic-bezier(.7,0,.36,1)
  -webkit-transition-delay: 250ms
  transition-delay: 250ms
  background-color: rgba(255,255,255,0.9)
  
#openModal
  > span
    font-family: raleway
    font-size: 1.2vw
    top: 40%
    position: absolute
    left: 50%
    white-space: nowrap
    -webkit-transform: translate3d(-50%,0,0)
    color: rgba(0,0,0,0.7)
.separatorLine
  margin-top: 15px
  width: 300%
  position: absolute
  height: 1px
  background: rgba(0,0,0,0.6)
.clearfix:after 
  clear: both
  content: "."
  display: block
  height: 0
  visibility: hidden

.clearfix 
  display: inline-block

.clearfix 
  display: block
.right
  margin-left: 12.5vw
  bottom: 0
  position: absolute
  float: right
.right > p
  font-size: 2vw
  text-align: left
  text-transform: none
  font-family: Raleway
  margin-top: 0.5vw
  color: rgba(0,0,0,0.7)
  &:last-child
    margin-top: 0.2vw
    font-size: 0.9vw
    text-align: right
    color: rgba(0,0,0,0.5)
       
.avatar:hover
  > #camera 
    > #cameraFrame
      stroke-dashoffset: 0
.avatar:hover
  > #camera 
    > #circle
      stroke-dashoffset: 0px
.avatar:hover
  > #camera 
    > #plus
      stroke-dashoffset: 0px
      
.avatar:active
  > #camera
    > #cameraFrame
      -webkit-transition: none
      stroke: rgba(255,255,255,0.7)

.avatar:active
  > #camera
    > #circle
      -webkit-transition: none
      stroke: rgba(255,255,255,0.7)

.avatar:active
  > #camera
    > #plus
      -webkit-transition: none
      stroke: rgba(255,255,255,0)
.src
  font-family: raleway
  position: absolute
  display: inline-block
  right: 0
  bottom: 0
  padding: 10px
#camera
  -webkit-transition: 250ms cubic-bezier(.7,0,.36,1)
  transition: 250ms cubic-bezier(.7,0,.36,1)
.avatar.open
  > #camera
    -webkit-transform: scale(0)
    fill: white
.avatar.open
  > #openModal
    -webkit-transform: scale(0.95)
.avatar.open
  > #fileUpload
    opacity: 1
    -webkit-transition-delay: 250ms
.avatar.open
  > #camera
    visibility: hidden
            
          
!
            
              /*

*************
30.10 ~ included vendor prefixes
28.10 ~ added code that closed the upload frame if we click outside of our avatar.

This is the jQuery solution to our animation. Out of performance reasons I would always advise the usage of CSS animations or some other GPU accelerated animations with the  use of TweenJS, GSAP or VelocityJS.

I hope you like the animation, thanks! :)

*************

var circle = $('#circle').get(0);
var cl = circle.getTotalLength();

var frame = $('#cameraFrame').get(0);
var fl = frame.getTotalLength();

var plusG = $('#plus')
var plusLine = $('#plusLine').get(0).getTotalLength();
$(plusG).css({
  'stroke-dasharray':plusLine,
  'stroke-dashoffset':plusLine
});
$(circle).css({
  'stroke-dasharray':cl,
  'stroke-dashoffset':cl
});
console.log(plusLine)
$(frame).css({
  'stroke-dasharray':fl,
  'stroke-dashoffset':fl-fl
});
/*
$('.avatar').hover(
  function(){
    $(circle).css({
      'stroke-dashoffset':0
    });
    $(frame).css({
      'stroke-dashoffset':0
    });
    $(plusG).css({
      'stroke-dashoffset':0
    });
},function(){
   $(circle).css({
      'stroke-dashoffset':cl});
    $(frame).css({
      'stroke-dashoffset':fl
    });
  $(plusG).css({
      'stroke-dashoffset':plusLine
    });
});*/
$('#fileUpload').on('change',function(){
  $('.avatar').removeClass('open');
});
$('.avatar').on('click',function(){
  $(this).addClass('open');
});
// added code to close the modal if you click outside
$('html').click(function() {
 $('.avatar').removeClass('open');
});

$('.avatar').click(function(event){
    event.stopPropagation();
});


            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console