class_visibilitynotifier2d.rst 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the VisibilityNotifier2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisibilityNotifier2D:
  6. VisibilityNotifier2D
  7. ====================
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`VisibilityEnabler2D<class_VisibilityEnabler2D>`
  10. Detects when the node is visible on screen.
  11. Description
  12. -----------
  13. The VisibilityNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
  14. Properties
  15. ----------
  16. +---------------------------+-------------------------------------------------------+-------------------------------+
  17. | :ref:`Rect2<class_Rect2>` | :ref:`rect<class_VisibilityNotifier2D_property_rect>` | ``Rect2( -10, -10, 20, 20 )`` |
  18. +---------------------------+-------------------------------------------------------+-------------------------------+
  19. Methods
  20. -------
  21. +-------------------------+---------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`is_on_screen<class_VisibilityNotifier2D_method_is_on_screen>` **(** **)** const |
  23. +-------------------------+---------------------------------------------------------------------------------------+
  24. Signals
  25. -------
  26. .. _class_VisibilityNotifier2D_signal_screen_entered:
  27. - **screen_entered** **(** **)**
  28. Emitted when the VisibilityNotifier2D enters the screen.
  29. ----
  30. .. _class_VisibilityNotifier2D_signal_screen_exited:
  31. - **screen_exited** **(** **)**
  32. Emitted when the VisibilityNotifier2D exits the screen.
  33. ----
  34. .. _class_VisibilityNotifier2D_signal_viewport_entered:
  35. - **viewport_entered** **(** :ref:`Viewport<class_Viewport>` viewport **)**
  36. Emitted when the VisibilityNotifier2D enters a :ref:`Viewport<class_Viewport>`'s view.
  37. ----
  38. .. _class_VisibilityNotifier2D_signal_viewport_exited:
  39. - **viewport_exited** **(** :ref:`Viewport<class_Viewport>` viewport **)**
  40. Emitted when the VisibilityNotifier2D exits a :ref:`Viewport<class_Viewport>`'s view.
  41. Property Descriptions
  42. ---------------------
  43. .. _class_VisibilityNotifier2D_property_rect:
  44. - :ref:`Rect2<class_Rect2>` **rect**
  45. +-----------+-------------------------------+
  46. | *Default* | ``Rect2( -10, -10, 20, 20 )`` |
  47. +-----------+-------------------------------+
  48. | *Setter* | set_rect(value) |
  49. +-----------+-------------------------------+
  50. | *Getter* | get_rect() |
  51. +-----------+-------------------------------+
  52. The VisibilityNotifier2D's bounding rectangle.
  53. Method Descriptions
  54. -------------------
  55. .. _class_VisibilityNotifier2D_method_is_on_screen:
  56. - :ref:`bool<class_bool>` **is_on_screen** **(** **)** const
  57. If ``true``, the bounding rectangle is on the screen.
  58. **Note:** It takes one frame for the node's visibility to be assessed once added to the scene tree, so this method will return ``false`` right after it is instantiated, even if it will be on screen in the draw pass.