Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eonist/6d372b4c16b97e2bf606d0f5fc9c71f9 to your computer and use it in GitHub Desktop.
Save eonist/6d372b4c16b97e2bf606d0f5fc9c71f9 to your computer and use it in GitHub Desktop.
make 3 rects, gradients and then apply them

Lets run through our tests to make sure our new code changes still work in all tests. here is the tests to run. its 3 tests. gradient, shapes, text. here it is: # Prompt: “Three-Rectangle Gradient Showcase”

  • Create three 100×100 rectangles named LinearRect, RadialRect, and MulticolorRect.
  • Arrange them horizontally

Gradient styles to apply:

  1. LinearGradient
    – Type: linear
    – Color stops:

    • 0 → RGBA(255, 0, 0, 1) (red)
    • 1 → RGBA(0, 0, 255, 1) (blue)
      – Transform: 90° rotation (vertical sweep). Matrix
      ⎡0 1 0⎤
      ⎣-1 0 1⎦
  2. RadialGradient
    – Type: radial
    – Color stops:

    • 0 → RGBA(255, 255, 0, 1) (yellow center)
    • 1 → RGBA(255, 0, 0, 1)  (red edge)
      – Transform: identity matrix (centered).
  3. MulticolorGradient
    – Type: linear
    – Color stops:

    • 0 → RGBA(255, 0, 0, 1) (red)
    • 0.5 → RGBA(0, 255, 0, 1) (green)
    • 1 → RGBA(0, 0, 255, 1) (blue)
      – Transform: no rotation (horizontal sweep).

Apply:

  • LinearGradient to LinearRect (fill).
  • RadialGradient to RadialRect (fill).
  • MulticolorGradient to MulticolorRect (fill).

Final result: a neat row of three gradient-filled squares

verification: after each style and shape has been created call: get node info command to and other getter commands to verify what we created has the intended values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment