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.

            
              const { render } = ReactDOM
const { Component } = React
const { css, injectGlobal, default: styled } = styled
const { min, max, rem, em } = styleUtils

injectGlobal`
  body {
    margin: 0;
  }
`

const Wrapper = styled.div`
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: 0 ${rem(50)};
  background-color: dodgerblue;
`

const Link = styled.a`
  -webkit-tap-highlight-color: transparent;
`

const blurShape = "M110,60c0,27.6-22.4,50-50,50c-27.6,0-50-22.4-50-50c0-27.6,22.4-50,50-50C87.6,10,110,32.4,110,60z";
const activeShape = "M96,60c0,27.6-8.4,53-36,53c-27.6,0-36-25.4-36-53c0-27.6,8.4-53,36-53C87.6,7,96,32.4,96,60z";

class Arrow extends Component {
  onActive = () => TweenMax.to(this.circle, .5, {
    attr: { d: activeShape },
    transformOrigin: 'center',
    ease: Elastic.easeOut
  });

  onBlur = () => TweenMax.to(this.circle, 1, {
    attr: { d: blurShape },
    ease: Elastic.easeOut
  });

  render() {
    const { className } = this.props
    const arrowID = Math.random()

    return (
      <div
        className={className}
        onMouseDown={this.onActive}
        onTouchStart={this.onActive}
        onMouseLeave={this.onBlur}
        onMouseUp={this.onBlur}
      >
        <svg
          viewBox="0 0 120 120"
          preserveAspectRatio="none"
          width="100%" height="100%"
        >
          <mask id={`${arrowID}`}>
            <rect fill="#fff" width="100%" height="100%"/>
            <path fill="#000" className="arrow" d="M48.5,61.5v-2.9h17.4l-8-8l2.1-2.1L71.5,60L60,71.5l-2.1-2.1l8-8H48.5z" />
          </mask>
          <path ref={el => this.circle = el} mask={`url(#${arrowID})`} d={blurShape} />
        </svg>
      </div>
    )
  }
}

Arrow = styled(Arrow)`
  width: ${rem(60)};
  height: ${rem(60)};
  fill: #fff;
  cursor: inherit;

  ${min(500)`
    width: ${rem(120)};
    height: ${rem(120)};
  `}

  ${({left}) => left && `transform: rotate(180deg);`}

  .arrow {
    ${max(500)`
      transform-origin: center;
      transform: scale(1.6);
    `}
  }
`

render(
  <Wrapper>
    <Link href="#"><Arrow left /></Link>
    <Link href="#"><Arrow /></Link>
  </Wrapper>,
  document.getElementById('root')
)

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

Console