const Engine = Matter.Engine,
const engine = Engine.create();
const render = Render.create({
const topWall = Bodies.rectangle(400, 10, 800, 20, { isStatic: true });
const leftWall = Bodies.rectangle(10, 150, 20, 300, { isStatic: true });
const rightWall = Bodies.rectangle(790, 150, 20, 300, { isStatic: true });
const bottomWall = Bodies.rectangle(400, 290, 800, 20, { isStatic: true });
const ball = Bodies.circle(90, 280, 20, {
texture: "https://opengameart.org/sites/default/files/styles/medium/public/SoccerBall_0.png",
World.add(engine.world, [topWall, leftWall, rightWall, bottomWall, ball]);
document.querySelector('#force').addEventListener('click', function () {
Body.applyForce( ball, {x: ball.position.x, y: ball.position.y}, {x: 0.04, y: 0});
document.querySelector('#vforce').addEventListener('click', function () {
Body.applyForce( ball, {x: ball.position.x, y: ball.position.y}, {x: 0, y: -0.04});
document.querySelector('#red-friction').addEventListener('click', function () {
ball.frictionAir = 0.0005;
document.querySelector('#res-friction').addEventListener('click', function () {
ball.frictionAir = 0.001;