Class GElement

java.lang.Object
com.vaadin.flow.dom.Node<com.vaadin.flow.dom.Element>
com.vaadin.flow.dom.Element
All Implemented Interfaces:
Serializable

public class GElement extends SvgGraphicsElement
A typed Java API for the SVG <g> (group) element.

The <g> element is a container used to group other SVG elements. Transformations applied to the <g> element are performed on its child elements. Attributes applied to the <g> element are inherited by its children.

Groups are useful for:

  • Applying transformations to multiple elements at once
  • Applying common styles to multiple elements
  • Organizing complex drawings into logical parts
See Also:
  • Constructor Details

    • GElement

      public GElement()
  • Method Details

    • add

      public GElement add(SvgElement... children)
      Appends child elements to this group.
      Parameters:
      children - the elements to add
      Returns:
      this element for method chaining
    • animateTranslate

      public AnimateTransformElement animateTranslate()
      Creates a translation animation and appends it to this group.

      This animates the entire group and all its children. Example usage:

      
       group.animateTranslate()
           .translateFromTo(0, 0, 100, 50)
           .dur(Duration.ofSeconds(2))
           .beginElement();
       
      Returns:
      the animation element for further configuration
    • animateRotate

      public AnimateTransformElement animateRotate()
      Creates a rotation animation and appends it to this group.

      This animates the entire group and all its children. Example usage:

      
       group.animateRotate()
           .rotateFromTo(0, 360, 50, 50)  // rotate around center (50,50)
           .dur(Duration.ofSeconds(2))
           .beginElement();
       
      Returns:
      the animation element for further configuration
    • animateScale

      public AnimateTransformElement animateScale()
      Creates a scale animation and appends it to this group.

      This animates the entire group and all its children. Example usage:

      
       group.animateScale()
           .scaleFromTo(1, 2)  // scale from 1x to 2x
           .dur(Duration.ofSeconds(1))
           .beginElement();
       
      Returns:
      the animation element for further configuration