Skip to content

StarNode

Overview

Star that fills in from left to right. This was originally created for score indicators in games, but it may have other uses.

@author Sam Reid (PhET Interactive Simulations) @author John Blanco (PhET Interactive Simulations)

Class StarNode

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

Constructor

new StarNode( providedOptions? : StarNodeOptions )

Instance Methods

Type StarNodeOptions

import type { StarNodeOptions } from 'scenerystack/scenery-phet';
  • value?: number
    The value, from 0 to 1, represented by this StarNode. A value of 0 shows a completely unfilled star, a value of 1 shows a completely filled star.
  • emptyFill?: TPaint
    Options that control the appearance of the unfilled (background) star. Should be bland.
  • emptyStroke?: TPaint
  • emptyLineWidth?: number
  • emptyLineJoin?: LineJoin
  • filledFill?: TPaint
    Options that control the appearance of the filled (foreground) star. Should be bold and eye catching.
  • filledStroke?: TPaint
  • filledLineWidth?: number
  • filledLineJoin?: LineJoin
  • starShapeOptions?: StarShapeOptions
    Options that are passed to the star shape to control things like its size and number of points.
  • & NodeOptions

Source Code

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