Author Topic: how to have anchored sprite keep aspect ratio?  (Read 2170 times)

genesys

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
how to have anchored sprite keep aspect ratio?
« on: March 16, 2014, 05:36:18 AM »
How can I achieve the following setup:


- Parent sprite that can get resized freely
   - child sprite that is located in the left side of it's parent, anchored to left border, top border and bottom border, but the right side of the sprite shall rescale such that the sprite always stays square
   - second child sprite that is to the right of the first child sprite, this one is anchored to right border, top border and bottom border of the parent, but it's left border shall scale such that it keeps the same distance from the first child

I hope the description is understandable, otherwise i'll create a graphic


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: how to have anchored sprite keep aspect ratio?
« Reply #1 on: March 16, 2014, 12:23:36 PM »
1. No anchor on the parent. Child sprites use Advanced type anchoring.
2. Child Left anchored to parent left. Top to parent top. Bottom to parent bottom. Right left unanchored. Aspect ratio set to 1 BasedOnHeight.
3. Second child sprite anchored: right to parent right, bottom to parent bottom, top to parent top, left side anchored to First Child's right.

Bijou Trouvaille

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: how to have anchored sprite keep aspect ratio?
« Reply #2 on: March 29, 2014, 06:37:43 PM »
I'm having trouble figuring out how to leave an edge unanchored.

It would make sense to me if there was a "Unanchored" choice in the drop-down that selects from [Target's Left, ..Right, ..Center, Custom, Current Pos]

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: how to have anchored sprite keep aspect ratio?
« Reply #3 on: March 30, 2014, 07:15:40 AM »
"Unanchored" = null for the target transform.