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.

+ 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.

            
              @import url('https://fonts.googleapis.com/css?family=Teko|Six+Caps');

html{
  box-sizing: border-box;
}
*,
:before,
:after {
  box-sizing: inherit;
}
body{
  height: 100vh;
  background: url(https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/papertexture.jpg) no-repeat 50% 50%;
  background-size: cover;
  overflow: hidden;
}

.logo{
  background: url(https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/logo.png) no-repeat 50% 50%;
  width: 300px;
  height: 175px;
  background-size: contain;
  margin: 0 auto;
  filter: brightness(0);
  transform: translate(0,2rem);
}
.textlayer{
  margin: 0 auto;
  white-space: nowrap;
  line-height: 1;
  position: relative;
  display: inline-block;
  font-family: 'Six Caps', sans-serif;
  text-align: center;
  text-transform: uppercase;
  font-size: 50rem;
  @include fluid-type(font-size, 25rem, 75rem, 20rem, 48rem);
  letter-spacing: -0.035em;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-image: url("https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/jarjar.jpg");
  background-position: 50% 50%;
  background-color: rgba(#000, 0.5);
  position: absolute;
  top: 45%;
  left: 0;
  right: 0;
  z-index: 700;
  transform: translateY(-50%);
  &.colour{
    z-index: 750;
    mix-blend-mode: multiply;
  }
}

.falcon{
  width: 516px * 0.75;
  height: 315px * 0.75;
  background: url(https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/falcon.png) no-repeat 50% 50%;
  background-size: contain;
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translate(-50%,0);
  z-index: 800;
}
.tiefighter{
  background: url(https://www.sideshowtoy.com/wp-content/uploads/2017/07/star-wars-tie-fighter-pewter-collectible-royal-selangor-silo-903094.png) no-repeat 50% 50%;
  background-size: contain;
  width: 480px * 0.1;
  height: 458px * 0.1;
  position: absolute;
  left: 50%;
}
.t-1{
  transform: translate(-250px,0);
  bottom: 9rem;
}
.t-2{
  transform: translate(200px,0) scale(-1, 1);
  bottom: 7rem;
}
.t-3{
  transform: translate(300px,0);
}
.date{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-transform: uppercase;
  text-align: center;
  font-size: 5rem;
  color: black;
  font-family: 'Teko', sans-serif;
}

.options{
  background: rgba(black, 0.5);
  padding-top: 5px;
  padding-bottom: 5px;
  // opacity: 0.25;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  input{
    background: rgba(#000, 0.5);
    display: inline-block;
    margin: 0 0.5em;
    padding: 3px 5px;
    text-transform: uppercase;
    color: white;
    border: 1px solid white;
    border-radius: 1px;
  }
}

select{
  border-radius: 1px;
  border: 1px solid white;
  background: rgba(#000, 0.5);
  color: white;
  display: inline-block;
  text-transform: uppercase;
}
.explainer{
  color: white;
  display: block;
  font-size: 10px;
}

.dropbox{
  z-index: 800;
  opacity: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  width: 90vw;
  height: 90vh;
  background: rgba(#000, 0.5);
  top: 5vh;
  left: 5vw;
  border: 5px dashed white;
  border-radius: 50px;
  transition: 50ms ease-out;
  .active &{
    opacity: 1;
    z-index: 1100;
  }
  &:after{
    content:"Drop image here";
    color: white;
    font-size: 5rem;
    text-transform: uppercase;
    text-align: center;
  }
}
            
          
!
            
              class Application extends React.Component {
  constructor(props) {
    super(props);

    this.onDropdownChange = this.onDropdownChange.bind(this);
    this.onNameChange = this.onNameChange.bind(this);
    this.onFileReaderLoaded = this.onFileReaderLoaded.bind(this);
    this.dragenter = this.dragenter.bind(this);
    this.dragleave = this.dragleave.bind(this);
    this.dragover = this.dragover.bind(this);
    this.drop = this.drop.bind(this);
    this.hover = this.hover.bind(this);
    this.colours = [
      'linear-gradient(135deg, #4CA1AF, #C4E0E5)',
      'linear-gradient(135deg, #ff6a00, #ee0979)',
      'linear-gradient(135deg, #C02425, #F0CB35)',
      'linear-gradient(135deg, #ADD100, #7B920A)',
      'linear-gradient(135deg, #757F9A, #D7DDE8)',
      'linear-gradient(135deg, #FF8008, #FFC837)',
      'linear-gradient(135deg, #cc2b5e, #753a88)',
      'linear-gradient(135deg, #3E5151, #DECBA4)'
    ];
    
    this.state = {
      image: 'https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/jarjar.jpg',
      name: 'jarjar',
      colour: this.colours[Math.floor(Math.random()*this.colours.length)]
    };
  }
  
  onDropdownChange(ev) {
    console.log(ev.target);

    this.setState({
      image: ev.target.value,
      name: ev.target.options[ev.target.selectedIndex].label,
      colour: this.colours[Math.floor(Math.random()*this.colours.length)]
    })
  }
  onNameChange(ev) {
    this.setState({
      name: ev.target.value
    })
  }
  
  dragenter(ev) {
    ev.stopPropagation();
    ev.preventDefault();
    document.body.classList.add('active');
  }
  
  dragleave(ev) {
    ev.stopPropagation();
    ev.preventDefault();
    document.body.classList.remove('active');
  }
  
  dragover(ev) {
    ev.stopPropagation();
    ev.preventDefault();
    document.body.classList.add('active');
  }
  
  onFileReaderLoaded(ev) {
    this.setState({
      image: ev.target.result
    })
  }
  
  drop(ev) {
    ev.stopPropagation();
    ev.preventDefault();
    document.body.classList.remove('active');
    const file = ev.dataTransfer.files[0];
    if (!file || file.type.indexOf('image/') !== 0) {
      console.warn('NOT AN IMAGE');
    } else {
      var reader = new FileReader();
      reader.onload = this.onFileReaderLoaded;
      reader.readAsDataURL(file);
    }
  }
  
  hover(ev) {
  }
  
  loadFromDesktop(file, targetEl) {
  }
  
  onMouseMoveHandler(ev) {
    var containerEl = document.querySelector(".textlayer");
    // var winWidth = window.innerWidth;
    // var winHeight = window.innerHeight;
    var xPerc = 50;
    var yPerc = 50;
    // winWidth = window.innerWidth;
    // winHeight = window.innerHeight;
    xPerc = (ev.clientX / window.innerWidth * 100).toFixed(2);
    yPerc = (ev.clientY / window.innerHeight * 100).toFixed(2);
    containerEl.style.backgroundPosition = `${xPerc}% ${yPerc}%`;
  }
  
  render() {
    return <div onMouseMove={this.onMouseMoveHandler}>
      <div className="dropbox" onDragEnter={this.dragenter} onDragLeave={this.dragleave} onDragOver={this.dragover} onDrop={this.drop}></div>
      <div className="logo"></div>
      <div className="options">
        <select onChange={this.onDropdownChange}>
          <option value="https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/jarjar.jpg" >jarjar</option>
          <option value="https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/tarkin.jpg">Tarkin</option>
          <option value="https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/r2d2.jpg">r2d2</option>
          <option value="https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/c3po.jpg">c3po</option>
          <option value="https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/jabba.jpg">Jabba</option>
          <option value="https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/ig-88.jpg">IG-88</option>
          <option value="https://s3-ap-southeast-2.amazonaws.com/mephystoprojects/codepen/solo/lobot.jpeg">Lobot</option>
        </select>
        <input type="text" className="newname" placeholder="change name?" onChange={this.onNameChange} value={this.state.name}></input>
        <span className="explainer">Or drop an image from your desktop into the pen</span>
      </div>
      <div className="textlayer" style={{backgroundImage: `url(${this.state.image})`}}>{this.state.name}</div>
      <div className="textlayer colour" style={{backgroundImage: `${this.state.colour}`}}>{this.state.name}</div>
      <div className="falcon"></div>
      <div className="tiefighter t-1"></div>
      <div className="tiefighter t-2"></div>
      <div className="date">May 25</div>
      
    </div>;
  }
}

/*
 * Render the above component into the div#app
 */
React.render(<Application />, document.getElementById('app'));


            
          
!
999px
🕑 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.
Loading ..................

Console