feeles-ide
Version:
The hackable and serializable IDE to make learning material
28 lines (20 loc) • 392 B
JavaScript
import {
Body,
Composites,
World,
Bodies,
} from 'matter';
import {
world,
} from './setting';
// ニュートンのゆりかごをつくる
const cradle1 = Composites.newtonsCradle(280, 200, 5, 30, 200);
World.add(world, [
// ニュートンのゆりかご
cradle1,
]);
// 一番左の円だけを左上に動かす
Body.translate(cradle1.bodies[0], {
x: -180,
y: -100,
});