Phaser API Documentation

  Version: 
newtonsCradle(x, y, number, size, length)

Description:

Creates a composite with a Newton's Cradle setup of bodies and constraints.

Parameters:

name type description
x number

The horizontal position of the start of the cradle.

y number

The vertical position of the start of the cradle.

number number

The number of balls in the cradle.

size number

The radius of each ball in the cradle.

length number

The length of the 'string' the balls hang from.

Returns:
Description:

A Newton's cradle composite.

Type:
  • MatterJS.CompositeType
Since: 3.0.0