Skip to content

ArrowNode

Overview

A single- or double-headed arrow. This is a convenience class, most of the work is done in ArrowShape.

@author John Blanco @author Chris Malley (PixelZoom, Inc.) @author Aaron Davis @author Sam Reid (PhET Interactive Simulations)

Class ArrowNode

import { ArrowNode } from 'scenerystack/scenery-phet';

Constructor

new ArrowNode( tailX : number, tailY : number, tipX : number, tipY : number, providedOptions? : ArrowNodeOptions )

Instance Methods

setTailAndTip( tailX : number, tailY : number, tipX : number, tipY : number )

Sets the tail and tip positions to update the arrow shape. If the tail and tip are at the same point, the arrow is not shown.

setTail( tailX : number, tailY : number )

Sets the tail position.

setTip( tipX : number, tipY : number )

Sets the tip position.

setTailWidth( tailWidth : number )

Sets the tail width.

setDoubleHead( doubleHead : boolean )

Sets whether the arrow has one or two heads.

Type ArrowNodeOptions

import type { ArrowNodeOptions } from 'scenerystack/scenery-phet';
  • headHeight?: number
  • headWidth?: number
  • tailWidth?: number
  • isHeadDynamic?: boolean
  • scaleTailToo?: boolean
  • fractionalHeadHeight?: number
    head will be scaled when headHeight is greater than fractionalHeadHeight * arrow length
  • doubleHead?: boolean
    true puts heads on both ends of the arrow, false puts a head at the tip
  • & PathOptions

Source Code

See the source for ArrowNode.ts in the scenery-phet repository.