JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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="koala"></div>
body{
background: #25A9FC;
}
.box{
position: relative;
margin: auto;
display: block;
margin-top: 8%;
width: 600px;
height: 420px;
background: none;
border: solid 3px white;
}
.head{
position: absolute;
top:16.5%;
left: 25%;
width: 50%;
height: 67%;
background: #A6BECF;
border-radius: 50%;
z-index: 3;
}
.outer-ear-left{
position: absolute;
width: 33%;
height: 47%;
left: 17%;
top: 20%;
background: #A6BECF;
border-radius: 50%;
z-index: 1;
}
.outer-ear-right{
position: absolute;
width: 33%;
height: 47%;
right: 17%;
top: 20%;
background: #A6BECF;
border-radius: 50%;
z-index: 1;
}
.inner-ear-left{
position: absolute;
border-radius: 50%;
width: 28%;
height: 40%;
top: 23.5%;
left: 19.5%;
background: #819CAF;
z-index: 2;
}
.inner-ear-right{
position: absolute;
border-radius: 50%;
width: 28%;
height: 40%;
top: 23.5%;
right: 19.5%;
background: #819CAF;
z-index: 2;
}
.outer-eye-left{
position: absolute;
background: white;
width: 16%;
height: 22%;
top: 32%;
left: 35%;
border-radius: 50%;
z-index: 4;
}
.outer-eye-right{
position: absolute;
background: white;
width: 16%;
height: 22%;
top: 32%;
right: 35%;
border-radius: 50%;
z-index: 4;
}
.pupil-left{
position: absolute;
width: 4.5%;
height: 7%;
top: 40%;
left: 40.5%;
border-radius: 50%;
background: #27354A;
z-index: 5;
}
.pupil-right{
position: absolute;
width: 4.5%;
height: 7%;
top: 40%;
right: 40.5%;
border-radius: 50%;
background: #27354A;
z-index: 5;
}
.nose{
position: absolute;
background: #BE845F;
width: 13%;
height: 30.5%;
left: 43.5%;
top: 45%;
border-radius: 50px;
z-index: 5;
}
.hair-left{
position: absolute;
top: 12%;
left: 39%;
width: 10%;
height: 12%;
background: #A6BECF;
-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.hair-right{
position: absolute;
top: 14%;
left: 50%;
width: 10%;
height: 12%;
background: #A6BECF;
-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
@media all and (max-width: 600px) {
.box{
position: relative;
margin: auto;
display: block;
margin-top: 2%;
width: 400px;
height: 280px;
background: none;
}
}
//village
class Koala extends React.Component {
render() {
return (
<Box colors={this.props.colors}/>
)
}
}
//neighborhood
class Box extends React.Component {
render() {
return (
<div className="box">
<EarLeft colors={this.props.colors}/>
<EarRight colors={this.props.colors}/>
<EyeLeft colors={this.props.colors}/>
<EyeRight colors={this.props.colors}/>
<Head colors={this.props.colors}/>
<Nose color={this.props.colors.brown}/>
<HairLeft color={this.props.colors.lightGray}/>
<HairRight color={this.props.colors.lightGray}/>
</div>
)
}
}
//blocks
class EarLeft extends React.Component {
render() {
return (
<div>
<OuterEarLeft color={this.props.colors.lightGray}/>
<InnerEarLeft color={this.props.colors.darkGray}/>
</div>
)
}
}
class EarRight extends React.Component {
render() {
return (
<div>
<OuterEarRight color={this.props.colors.lightGray}/>
<InnerEarRight color={this.props.colors.darkGray}/>
</div>
)
}
}
class EyeLeft extends React.Component {
render() {
return (
<div>
<OuterEyeLeft color={this.props.colors.white}/>
<PupilLeft color={this.props.colors.navy}/>
</div>
)
}
}
class EyeRight extends React.Component {
render() {
return (
<div>
<OuterEyeRight color={this.props.colors.white}/>
<PupilRight color={this.props.colors.navy}/>
</div>
)
}
}
//houses
class Head extends React.Component {
state = {color: this.props.colors.lightGray};
componentDidMount() {
setTimeout( () => {
this.setState({color: this.props.colors.darkGray});
}, 1000)
}
componentWillMount() {
this.setState({color: this.props.colors.white});
}
updateColor() {
this.setState({color: this.props.colors.darkGray});
}
render() {
return (
<div onClick={this.updateColor.bind(this)} style={{background: this.state.color}} className="head"></div>
)
}
}
class Nose extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="nose"></div>
)
}
}
class HairLeft extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="hair-left"></div>
)
}
}
class HairRight extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="hair-right"></div>
)
}
}
class OuterEarRight extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="outer-ear-right"></div>
)
}
}
class InnerEarRight extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="inner-ear-right"></div>
)
}
}
class OuterEarLeft extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="outer-ear-left"></div>
)
}
}
class InnerEarLeft extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="inner-ear-left"></div>
)
}
}
class OuterEyeLeft extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="outer-eye-left"></div>
)
}
}
class PupilLeft extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="pupil-left"></div>
)
}
}
class OuterEyeRight extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="outer-eye-right"></div>
)
}
}
class PupilRight extends React.Component {
render() {
return (
<div style={{background: this.props.color}} className="pupil-right"></div>
)
}
}
//props objects
const colorsObject = {white: "#FFFFFF", lightGray: "#A6BECF", darkGray: "#819CAF", brown: "#BE845F", navy: "#27354A"}
//"inject" to DOM
ReactDOM.render(
<Koala colors={colorsObject}/>,
document.getElementById('koala')
);
Also see: Tab Triggers