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

Close Path doesn't return this #26696

Closed
WORMSS opened this issue Sep 5, 2023 · 1 comment · Fixed by #26697
Closed

Close Path doesn't return this #26696

WORMSS opened this issue Sep 5, 2023 · 1 comment · Fixed by #26697

Comments

@WORMSS
Copy link
Contributor

WORMSS commented Sep 5, 2023

Description

All other draw commands return this so you are able to chain the commands such as below

const shape = new THREE.Shape()
    .moveTo(0.786, -1.022)
    .quadraticCurveTo(1.199, -1.378, 1.805, -1.272)
    .lineTo(3.163, -0.971)
    .absarc(3.15, 0.01, thickness, TAU * .75, TAU * 0.25, true)
    .lineTo(1.987, -0.947)
    .quadraticCurveTo(1.118, -1.046, .683, -.55)
    .lineTo(0.05, 0.062)
    .absarc(0, 0, thickness, TAU * .125, TAU * 0.625, true);

The problem comes when you want to use closePath(); This leaves you with a void. So you end up having to do

const shape = new THREE.Shape()
    .moveTo(0.786, -1.022)
    .quadraticCurveTo(1.199, -1.378, 1.805, -1.272)
    .lineTo(3.163, -0.971)
    .absarc(3.15, 0.01, thickness, TAU * .75, TAU * 0.25, true)
    .lineTo(1.987, -0.947)
    .quadraticCurveTo(1.118, -1.046, .683, -.55)
    .lineTo(0.05, 0.062)
    .absarc(0, 0, thickness, TAU * .125, TAU * 0.625, true);
shape.closePath();

and not just throw closePath on the end of the shape.

const shape = new THREE.Shape()
    .moveTo(0.786, -1.022)
    .quadraticCurveTo(1.199, -1.378, 1.805, -1.272)
    .lineTo(3.163, -0.971)
    .absarc(3.15, 0.01, thickness, TAU * .75, TAU * 0.25, true)
    .lineTo(1.987, -0.947)
    .quadraticCurveTo(1.118, -1.046, .683, -.55)
    .lineTo(0.05, 0.062)
    .absarc(0, 0, thickness, TAU * .125, TAU * 0.625, true)
    .closePath();

Reproduction steps

Code

See description

Live example

See Description

Screenshots

No response

Version

0.156.0

Device

No response

Browser

No response

OS

No response

@WORMSS
Copy link
Contributor Author

WORMSS commented Sep 5, 2023

Wow, that was fast, thank you @Mugen87

I was expecting a lot more resistance. (As is usually the case with big projects)..

Again, thank you.

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

Successfully merging a pull request may close this issue.

2 participants