Class: RopeGeometry

PIXI.RopeGeometry

RopeGeometry allows you to draw a geometry across several points and then manipulate these points.

for (let i = 0; i < 20; i++) {
    points.push(new PIXI.Point(i * 50, 0));
};
const rope = new PIXI.RopeGeometry(100, points);

new PIXI.RopeGeometry (width, points, textureScale) overrides

Name Type Default Description
width number 200

The width (i.e., thickness) of the rope.

points IPoint[]

An array of PIXI.Point objects to construct this rope.

textureScale number 0

By default the rope texture will be stretched to match rope length. If textureScale is positive this value will be treated as a scaling factor and the texture will preserve its aspect ratio instead. To create a tiling rope set baseTexture.wrapMode to PIXI.WRAP_MODES.REPEAT and use a power of two texture, then set textureScale=1 to keep the original texture pixel size. In order to reduce alpha channel artifacts provide a larger texture and downsample - i.e. set textureScale=0.5 to scale it down twice.

Extends

Members

_width number readonly

The width (i.e., thickness) of the rope.

points IPoint[]

An array of points that determine the rope.

textureScale number readonly

Rope texture scale, if zero then the rope texture is stretched.

width number readonly

The width (i.e., thickness) of the rope.

Methods

updateVertices () void

refreshes vertices of Rope mesh

Inherited Properties

From class PIXI.Geometry

glVertexArrayObjects object inherited

A map of renderer IDs to webgl VAOs

instanceCount number inherited

Number of instances in this geometry, pass it to GeometrySystem.draw().

Default Value:
  • 1

instanced boolean inherited

Whether the geometry is instanced.

refCount number inherited

Count of existing (not destroyed) meshes that reference this geometry.

Inherited Methods

From class PIXI.Geometry

addAttribute (id, buffer, size, normalized, type, stride, start, instance) this inherited

Adds an attribute to the geometry Note: stride and start should be undefined if you dont know them, not 0!

Name Type Attributes Default Description
id string

the name of the attribute (matching up to a shader)

buffer PIXI.Buffer | number<Array>

the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.

size number 0

the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2

normalized boolean false

should the data be normalized.

type PIXI.TYPES <optional>
PIXI.TYPES.FLOAT

what type of number is the attribute. Check {PIXI.TYPES} to see the ones available

stride number <optional>
0

How far apart, in bytes, the start of each value is. (used for interleaving data)

start number <optional>
0

How far into the array to start reading values (used for interleaving data)

instance boolean false

Instancing flag

Returns:
Type Description
this
  • Returns self, useful for chaining.

Adds an index buffer to the geometry The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.

Name Type Attributes Description
buffer PIXI.Buffer | number<Array> <optional>

The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.

Returns:
Type Description
PIXI.Geometry
  • Returns self, useful for chaining.

Returns a clone of the geometry.

Returns:
Type Description
PIXI.Geometry
  • A new clone of this geometry.

destroy () void inherited

Destroys the geometry.

dispose () void inherited

Disposes WebGL resources that are connected to this geometry.

Returns the requested attribute.

Name Type Description
id string

The name of the attribute required

Returns:
Type Description
PIXI.Attribute
  • The attribute requested.

Returns the requested buffer.

Name Type Description
id string

The name of the buffer required.

Returns:
Type Description
PIXI.Buffer
  • The buffer requested.

Returns the index buffer

Returns:
Type Description
PIXI.Buffer
  • The index buffer.

getSize () number inherited

Get the size of the geometries, in vertices.

Returns:
Type Description
number

This function modifies the structure so that all current attributes become interleaved into a single buffer This can be useful if your model remains static as it offers a little performance boost

Returns:
Type Description
PIXI.Geometry
  • Returns self, useful for chaining.