const main = document.querySelector('.container');
class Header extends React.Component {
render() {
return (
<header>
<div className="brand">History</div>
<nav>
<ul>
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
<li>Menu 5</li>
</ul>
</nav>
</header>
);
}
}
class LeftSidebar extends React.Component {
render() {
return (
<aside className="leftSidebar">
</aside>
);
}
}
class RightSidebar extends React.Component {
render() {
return (
<aside className="RightSidebar">
</aside>
);
}
}
class Main extends React.Component {
render() {
return (
<Header/>
<RightSidebar/>
<LeftSidebar/>
);
}
}
ReactDOM.render(<Main/>,main);
const main = document.querySelector('.container');
class Header extends React.Component {
render() {
return (
<header>
<div className="brand">History</div>
<nav>
<ul>
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
<li>Menu 5</li>
</ul>
</nav>
</header>
);
}
}
class LeftSidebar extends React.Component {
render() {
return (
<aside className="leftSidebar">
</aside>
);
}
}
class RightSidebar extends React.Component {
render() {
return (
<aside className="RightSidebar">
</aside>
);
}
}
ReactDOM.render(<Header/>,main);
ReactDOM.render(<RightSidebar/>,main);
ReactDOM.render(<LeftSidebar/>,main);
function Blob(x,y,r) {
this.pos = createVector(x,y);
this.oldX = this.pos.x;
this.oldY = this.pos.y;
this.r = r;
this.update = function(speed) {
var vel = createVector(mouseX-width/2,mouseY-height/2);
vel.setMag(speed);
this.pos.add(vel);
}
this.show = function() {
image(player,this.pos.x-this.r,this.pos.y-this.r, this.r*2, this.r*2);
}
this.hp = function() {
image(playerhp, this.pos.x-playerhp.width/6, this.pos.y+this.r, playerhp.width/5,playerhp.height/3);
image(playerhpborder, this.pos.x-playerhp.width/6, this.pos.y+this.r, playerhpborder.width/3,playerhpborder.height/3);
}
}
//Обработчик
if(blob.pos.x - blob.oldX > block[i].pos.x+blockbg.width) {
blob.pos.x = block[i].pos.x+blockbg.width+blob.r;
}
if(blob.pos.x+blob.r/2+25 >= block[i].pos.x && blob.pos.x <= block[i].pos.x+blockbg.width+blob.r && blob.pos.y >= block[i].pos.y-blob.r && blob.pos.y <= block[i].pos.y+blockbg.height+blob.r) {
if(blob.pos.x+blob.r/2+25 >= block[i].pos.x) {
blob.pos.x = blob.pos.x-blob.r;
}
if(blob.pos.x <= block[i].pos.x+blockbg.width+blob.r) {
blob.pos.x = blob.pos.x+blob.r;
}
if(blob.pos.y >= block[i].pos.y-blob.r) {
blob.pos.y = blob.pos.y-blob.r;
}
if(blob.pos.y <= block[i].pos.y+blockbg.height+blob.r) {
blob.pos.y = blob.pos.y+blob.r;
}
}