Nothing

<rect>

Define a rectangle with optional rounded corners as a shape’s geometry.

Read as Markdown

Examples

The shape owns the rotation. The rectangle owns its local width. The shape’s translation and the rectangle’s default center registration keep the painted rectangle centered at (32, 24).

Download the complete .nothing source · Source on GitHub

Rendered with ncf-preview at 80 × 56.

A 12 × 8 white rectangle centered at (32, 24). Three smaller registration examples sit to its right.
Frame 0 · Initial poseA 12 × 8 white rectangle centered at (32, 24). Three smaller registration examples sit to its right.
The rectangle turns 90° clockwise. Its painted extent is 8 × 12 and its center stays at (32, 24).
Frame 4 · Quarter turnThe rectangle turns 90° clockwise. Its painted extent is 8 × 12 and its center stays at (32, 24).
The local width increases to 20 while the quarter turn holds. The painted extent is 8 × 20 and its center stays at (32, 24).
Frame 8 · Wider rectangleThe local width increases to 20 while the quarter turn holds. The painted extent is 8 × 20 and its center stays at (32, 24).
XML source
  <shape translate-x="32" translate-y="24">
    <animate attributeName="rotate" fill="freeze">
      <key frame="0" value="0" ease="linear"/>
      <key frame="4" value="90"/>
    </animate>
    <rect width="12" height="8">
      <animate attributeName="width" fill="freeze">
        <key frame="4" value="12" ease="linear"/>
        <key frame="8" value="20"/>
      </animate>
    </rect>
    <fill><paint><solid color="#FFFFFFFF"/></paint></fill>
  </shape>

The <rect> element defines the rectangular contour of a shape. With default registration and offsets, its center sits at the shape’s local origin. Set rotation on the owning shape.

Syntax

Set the rectangle to 10 local units wide and 6 high. With both anchor values at zero, its top-left corner sits at the shape’s local origin.

<rect width="10" height="6" anchor-u="0" anchor-v="0"/>

Complete .nothing source

Usage context

Allowed parents are <shape>.

Inherits from Geometry.

Includes Registration.

Attributes

Property animation

width

Value local units · Required · Keys Scalar

Nonnegative rectangle width.

height

Value local units · Required · Keys Scalar

Nonnegative rectangle height.

corner-radius

Value local units · If omitted 0 · Keys Scalar

Shared nonnegative circular corner radius. Rectangle corners

corner-top-left-radius

Value local units · If omitted Sampled corner-radius · Keys Scalar

Nonnegative radius of the local top-left corner. Rectangle corners

corner-top-right-radius

Value local units · If omitted Sampled corner-radius · Keys Scalar

Nonnegative radius of the local top-right corner. Rectangle corners

corner-bottom-right-radius

Value local units · If omitted Sampled corner-radius · Keys Scalar

Nonnegative radius of the local bottom-right corner. Rectangle corners

corner-bottom-left-radius

Value local units · If omitted Sampled corner-radius · Keys Scalar

Nonnegative radius of the local bottom-left corner. Rectangle corners

anchor-u

Value fraction of width · If omitted 0.5 · Keys Scalar · Declared by Registration

Horizontal registration. Zero selects the left edge and one the right edge. Values outside that interval extrapolate.

anchor-v

Value fraction of height · If omitted 0.5 · Keys Scalar · Declared by Registration

Vertical registration. Zero selects the top edge and one the bottom edge. Values outside that interval extrapolate.

offset-x

Value local units · If omitted 0 · Keys Scalar · Declared by Registration

Horizontal coordinate of the registered point.

offset-y

Value local units · If omitted 0 · Keys Scalar · Declared by Registration

Vertical coordinate of the registered point.

Children

ElementsCardinalityDeclared byRole and source order
<animate>Zero or moreAnimationA track targets one keyable property on this owner. For equal first-key times, the later track in document order wins. Evaluating animation tracks

Specifications

On this page