Module javafx.graphics
Package javafx.scene

# Class PointLight

java.lang.Object
javafx.scene.Node
javafx.scene.LightBase
javafx.scene.PointLight

All Implemented Interfaces:
  `Styleable`, `EventTarget`

Direct Known Subclasses:
  `SpotLight`

public class PointLight extends LightBase
A light source that radiates light equally in all directions away from itself. The location of the light source is a single point in space. It is attenuated with the `constantAttenuation`, `linearAttenuation`, `quadraticAttenuation`, and `maxRange` properties.

`PointLight`s can represent point-like light sources with little to no directionality. Light bulbs and candles are common light sources that can be simulated with this light type.

Since:
  JavaFX 8.0
See Also:
  - `PhongMaterial`

- ## Property Summary

  Properties
  Type
  Property
  Description
  `final DoubleProperty`
  `constantAttenuation`
  The constant attenuation coefficient.
  `final DoubleProperty`
  `linearAttenuation`
  The linear attenuation coefficient.
  `final DoubleProperty`
  `maxRange`
  The maximum range of this `PointLight`.
  `final DoubleProperty`
  `quadraticAttenuation`
  The quadratic attenuation coefficient.

  ### Properties declared in class javafx.scene.LightBase

  `color, lightOn`

  ### Properties declared in class javafx.scene.Node

  `accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible`

- ## Field Summary

  ### Fields declared in class javafx.scene.Node

  `BASELINE_OFFSET_SAME_AS_HEIGHT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PointLight()`
  Creates a new instance of `PointLight` class with a default `Color.WHITE` light source.
  `PointLight(Color color)`
  Creates a new instance of `PointLight` class using the specified color.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final DoubleProperty`
  `constantAttenuationProperty()`
  The constant attenuation coefficient.
  `final double`
  `getConstantAttenuation()`
  Gets the value of the `constantAttenuation` property.
  `final double`
  `getLinearAttenuation()`
  Gets the value of the `linearAttenuation` property.
  `final double`
  `getMaxRange()`
  Gets the value of the `maxRange` property.
  `final double`
  `getQuadraticAttenuation()`
  Gets the value of the `quadraticAttenuation` property.
  `final DoubleProperty`
  `linearAttenuationProperty()`
  The linear attenuation coefficient.
  `final DoubleProperty`
  `maxRangeProperty()`
  The maximum range of this `PointLight`.
  `final DoubleProperty`
  `quadraticAttenuationProperty()`
  The quadratic attenuation coefficient.
  `final void`
  `setConstantAttenuation(double value)`
  Sets the value of the `constantAttenuation` property.
  `final void`
  `setLinearAttenuation(double value)`
  Sets the value of the `linearAttenuation` property.
  `final void`
  `setMaxRange(double value)`
  Sets the value of the `maxRange` property.
  `final void`
  `setQuadraticAttenuation(double value)`
  Sets the value of the `quadraticAttenuation` property.

  ### Methods declared in class javafx.scene.LightBase

  `colorProperty, getColor, getExclusionScope, getScope, isLightOn, lightOnProperty, setColor, setLightOn`

  ### Methods declared in class javafx.scene.Node

  `accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty`

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods declared in interface javafx.css.Styleable

  `getStyleableNode`

- ## Property Details

  - ### maxRange

    public final DoubleProperty maxRangeProperty
    The maximum range of this `PointLight`. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

    Lower `maxRange` values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic `maxRange` value by finding the distance where the attenuation is close enough to 0.

    Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its `scope` (or including them in its `exclusion scope`). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

    Default value:
      `Double.POSITIVE_INFINITY`
    Since:
      16
    See Also:
      - `getMaxRange()`
      - `setMaxRange(double)`
      - `maxRangeProperty()`

  - ### constantAttenuation

    public final DoubleProperty constantAttenuationProperty
    The constant attenuation coefficient. This is the term `ca` in the attenuation formula:

    `attn = 1 / (ca + la * dist + qa * dist^2)`

    where `dist` is the distance between the light source and the pixel.

    Default value:
      1
    Since:
      16
    See Also:
      - `getConstantAttenuation()`
      - `setConstantAttenuation(double)`
      - `constantAttenuationProperty()`

  - ### linearAttenuation

    public final DoubleProperty linearAttenuationProperty
    The linear attenuation coefficient. This is the term `la` in the attenuation formula:

    `attn = 1 / (ca + la * dist + qa * dist^2)`

    where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Since:
      16
    See Also:
      - `getLinearAttenuation()`
      - `setLinearAttenuation(double)`
      - `linearAttenuationProperty()`

  - ### quadraticAttenuation

    public final DoubleProperty quadraticAttenuationProperty
    The quadratic attenuation coefficient. This is the term `qa` in the attenuation formula:

    `attn = 1 / (ca + la * dist + qa * dist^2)`

    where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Since:
      16
    See Also:
      - `getQuadraticAttenuation()`
      - `setQuadraticAttenuation(double)`
      - `quadraticAttenuationProperty()`

- ## Constructor Details

  - ### PointLight

    public PointLight()
    Creates a new instance of `PointLight` class with a default `Color.WHITE` light source.

  - ### PointLight

    public PointLight(Color color)
    Creates a new instance of `PointLight` class using the specified color.
    Parameters:
      `color` - the color of the light source

- ## Method Details

  - ### setMaxRange

    public final void setMaxRange(double value)
    Sets the value of the `maxRange` property.
    Property description:
      The maximum range of this `PointLight`. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

      Lower `maxRange` values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic `maxRange` value by finding the distance where the attenuation is close enough to 0.

      Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its `scope` (or including them in its `exclusion scope`). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

    Default value:
      `Double.POSITIVE_INFINITY`
    Parameters:
      `value` - the value for the `maxRange` property
    Since:
      16
    See Also:
      - `getMaxRange()`
      - `maxRangeProperty()`

  - ### getMaxRange

    public final double getMaxRange()
    Gets the value of the `maxRange` property.
    Property description:
      The maximum range of this `PointLight`. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

      Lower `maxRange` values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic `maxRange` value by finding the distance where the attenuation is close enough to 0.

      Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its `scope` (or including them in its `exclusion scope`). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

    Default value:
      `Double.POSITIVE_INFINITY`
    Returns:
      the value of the `maxRange` property
    Since:
      16
    See Also:
      - `setMaxRange(double)`
      - `maxRangeProperty()`

  - ### maxRangeProperty

    public final DoubleProperty maxRangeProperty()
    The maximum range of this `PointLight`. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

    Lower `maxRange` values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic `maxRange` value by finding the distance where the attenuation is close enough to 0.

    Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its `scope` (or including them in its `exclusion scope`). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

    Default value:
      `Double.POSITIVE_INFINITY`
    Returns:
      the `maxRange` property
    Since:
      16
    See Also:
      - `getMaxRange()`
      - `setMaxRange(double)`

  - ### setConstantAttenuation

    public final void setConstantAttenuation(double value)
    Sets the value of the `constantAttenuation` property.
    Property description:
      The constant attenuation coefficient. This is the term `ca` in the attenuation formula:

      `attn = 1 / (ca + la * dist + qa * dist^2)`

      where `dist` is the distance between the light source and the pixel.

    Default value:
      1
    Parameters:
      `value` - the value for the `constantAttenuation` property
    Since:
      16
    See Also:
      - `getConstantAttenuation()`
      - `constantAttenuationProperty()`

  - ### getConstantAttenuation

    public final double getConstantAttenuation()
    Gets the value of the `constantAttenuation` property.
    Property description:
      The constant attenuation coefficient. This is the term `ca` in the attenuation formula:

      `attn = 1 / (ca + la * dist + qa * dist^2)`

      where `dist` is the distance between the light source and the pixel.

    Default value:
      1
    Returns:
      the value of the `constantAttenuation` property
    Since:
      16
    See Also:
      - `setConstantAttenuation(double)`
      - `constantAttenuationProperty()`

  - ### constantAttenuationProperty

    public final DoubleProperty constantAttenuationProperty()
    The constant attenuation coefficient. This is the term `ca` in the attenuation formula:

    `attn = 1 / (ca + la * dist + qa * dist^2)`

    where `dist` is the distance between the light source and the pixel.

    Default value:
      1
    Returns:
      the `constantAttenuation` property
    Since:
      16
    See Also:
      - `getConstantAttenuation()`
      - `setConstantAttenuation(double)`

  - ### setLinearAttenuation

    public final void setLinearAttenuation(double value)
    Sets the value of the `linearAttenuation` property.
    Property description:
      The linear attenuation coefficient. This is the term `la` in the attenuation formula:

      `attn = 1 / (ca + la * dist + qa * dist^2)`

      where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Parameters:
      `value` - the value for the `linearAttenuation` property
    Since:
      16
    See Also:
      - `getLinearAttenuation()`
      - `linearAttenuationProperty()`

  - ### getLinearAttenuation

    public final double getLinearAttenuation()
    Gets the value of the `linearAttenuation` property.
    Property description:
      The linear attenuation coefficient. This is the term `la` in the attenuation formula:

      `attn = 1 / (ca + la * dist + qa * dist^2)`

      where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Returns:
      the value of the `linearAttenuation` property
    Since:
      16
    See Also:
      - `setLinearAttenuation(double)`
      - `linearAttenuationProperty()`

  - ### linearAttenuationProperty

    public final DoubleProperty linearAttenuationProperty()
    The linear attenuation coefficient. This is the term `la` in the attenuation formula:

    `attn = 1 / (ca + la * dist + qa * dist^2)`

    where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Returns:
      the `linearAttenuation` property
    Since:
      16
    See Also:
      - `getLinearAttenuation()`
      - `setLinearAttenuation(double)`

  - ### setQuadraticAttenuation

    public final void setQuadraticAttenuation(double value)
    Sets the value of the `quadraticAttenuation` property.
    Property description:
      The quadratic attenuation coefficient. This is the term `qa` in the attenuation formula:

      `attn = 1 / (ca + la * dist + qa * dist^2)`

      where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Parameters:
      `value` - the value for the `quadraticAttenuation` property
    Since:
      16
    See Also:
      - `getQuadraticAttenuation()`
      - `quadraticAttenuationProperty()`

  - ### getQuadraticAttenuation

    public final double getQuadraticAttenuation()
    Gets the value of the `quadraticAttenuation` property.
    Property description:
      The quadratic attenuation coefficient. This is the term `qa` in the attenuation formula:

      `attn = 1 / (ca + la * dist + qa * dist^2)`

      where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Returns:
      the value of the `quadraticAttenuation` property
    Since:
      16
    See Also:
      - `setQuadraticAttenuation(double)`
      - `quadraticAttenuationProperty()`

  - ### quadraticAttenuationProperty

    public final DoubleProperty quadraticAttenuationProperty()
    The quadratic attenuation coefficient. This is the term `qa` in the attenuation formula:

    `attn = 1 / (ca + la * dist + qa * dist^2)`

    where `dist` is the distance between the light source and the pixel.

    Default value:
      0
    Returns:
      the `quadraticAttenuation` property
    Since:
      16
    See Also:
      - `getQuadraticAttenuation()`
      - `setQuadraticAttenuation(double)`