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

Packages

Add 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 or require. We'll also process your JavaScript with Babel.

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

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

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.

            
              <div id="reactArt"></div>
            
          
!
            
              body {
  background-color: #c2c9ef;
}

@keyframes second {
  0% {transform: translateX(-50%) rotate(0deg)}
  100% {transform: translateX(-50%) rotate(360deg)}
}

@keyframes minute {
  0% {transform: translateX(-50%) rotate(40deg)}
  100% {transform: translateX(-50%) rotate(400deg)}
}

@keyframes hour {
  0% {transform: translateX(-50%) rotate(-50deg)}
  100% {transform: translateX(-50%) rotate(310deg)}
}
            
          
!
            
              class Canvas extends React.Component {
  render() {
    return (
      <div className="canvas" style={this.props.styles}>
        <Clock styles={clockStyles} before={clockBefore} after={clockAfter} />
      </div>
    );
  }
}

class Clock extends React.Component {
  render() {
    return (
      <div className="clock" style={this.props.styles}>
        <Outer style={this.props.before} />
        <Second/>
        <Hour/>
        <Minute/>
        <Inner style={this.props.after} />
      </div>
    )
  }
}

class Outer extends React.Component {
  render() {
    return (
      <div style={this.props.style} />
    )
  }
}

class Inner extends React.Component {
  render() {
    return (
      <div style={this.props.style} />
    )
  }
}

class Second extends React.Component {
  render() {
    return (
      <div style={secondStyles} />
    )
  }
}

class Hour extends React.Component {
  render() {
    return (
      <div style={hourStyles} />
    )
  }
}

class Minute extends React.Component {
  render() {
    return (
      <div style={minuteStyles} />
    )
  }
}

const canvasStyle = {
  width: "100vh",
  height: "100vh",
  maxWidth: "300px",
  maxHeight: "300px",
  position: "absolute",
  top: 0,
  left: 0,
  right: 0,
  bottom: 0,
  margin: "auto"
};

const clockStyles = {
  position: "relative",
  width: "96%",
  height: "96%",
  margin: "2%",
  backgroundColor: "#546d79",
  borderRadius: "50%",
  boxShadow: "0 3px 3px 0px #444"
};

const clockBefore = {
  position: "absolute",
  top: "7%",
  left: "7%",
  width: "86%",
  height: "86%",
  backgroundColor: "#6170c0",
  borderRadius: "50%",
  boxShadow: "0 0 10px 0px #444"
};

const clockAfter = {
  position: "absolute",
  top: "50%",
  left: "50%",
  width: "8%",
  height: "8%",
  backgroundColor: "#f2f2f2",
  boxShadow: "0 3px 3px 0px #555",
  borderRadius: "50%",
  transform: "translate(-50%, -50%)"
}

let secondStyles = {
  position: "absolute",
  top: 0,
  left: "50%",
  width: "2.3%",
  height: "50%",
  backgroundColor: "#efefef",
  boxShadow: "1px 3px 3px 0px #444",
  transform: "translateX(-50%)",
  transformOrigin: "bottom center",
  animation: "second 60s infinite steps(60)"
}

let minuteStyles = {
  position: "absolute",
  top: 0,
  left: "50%",
  width: "5%",
  height: "50%",
  backgroundColor: "#f2f2f2",
  boxShadow: "2px 3px 7px 0px #555",
  transform: "translateX(-50%)",
  transformOrigin: "bottom center",
  animation: "minute 3600s infinite linear"
}

let hourStyles = {
  position: "absolute",
  top: "15%",
  left: "50%",
  width: "5%",
  height: "35%",
  backgroundColor: "#efefef",
  boxShadow: "-2px 0 5px 0px #555",
  transform: "translateX(-50%)",
  transformOrigin: "bottom center",
  animation: "hour 43200s infinite linear"
}

ReactDOM.render(
  <Canvas styles={canvasStyle} />,
  document.getElementById("reactArt")
);

            
          
!
999px

Console