Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visual bug with Rect #207

Closed
derpmagician opened this issue Feb 5, 2023 · 1 comment · Fixed by #221
Closed

visual bug with Rect #207

derpmagician opened this issue Feb 5, 2023 · 1 comment · Fixed by #221
Assignees
Labels
a-2d Relates to the 2d package b-bug Something isn't working c-accepted The issue is ready to be worked on

Comments

@derpmagician
Copy link

Describe the bug
if your Rect object has a radious of 30 or bellow and the size is less than 60 it will show deformed even if you scale it bigger
https://i.imgur.com/ycimoVB.gif

export default makeScene2D(function* (view) {

  const header = createRef<Rect>();
  view.add(
    <Rect
      ref={header}
      position={[0,0]}
      size={[50,50]}
      fill="ffffff"
      radius={30}
    />,
  );

  yield* all(

    header().scale.x(1, 1).to(5, 1).to(1, 1),
    header().scale.y(1, 1).to(5, 1).to(1, 1),
  );

Expected behavior
If applicable, a clear and concise description of what you expected to happen.

Console errors
If applicable, add a screenshot of the errors displayed in the console of your browser (F12) or your terminal.

Package versions (please complete the following information):

  • core: [e.g. 1.0.0]
  • ui: [e.g. 1.0.0]
@aarthificial
Copy link
Contributor

Changing the scale doesn't help because the radius is scaled together with the object.

This is a weird implementation quirk caused by the fact that we support overflowing corner radiuses, for example:

<Rect
  ref={header}
  position={[0, 0]}
  size={[50, 50]}
  fill="ffffff"
  radius={[40, 10, 10, 10]}
/>

image

A temporary solution for you would be to use 25 for the radius (half the width of your rect: 50 / 2 = 25)
But I'll check if the implementation can be improved to fix this.

@aarthificial aarthificial added b-bug Something isn't working c-accepted The issue is ready to be worked on a-2d Relates to the 2d package labels Feb 6, 2023
aarthificial added a commit to aarthificial/motion-canvas that referenced this issue Feb 6, 2023
aarthificial added a commit that referenced this issue Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-2d Relates to the 2d package b-bug Something isn't working c-accepted The issue is ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants