-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
<Bounds /> #408
Comments
I would like to implement this. This can be fixed if the rendered 2d output is taken for determining the distance the camera has to be. This could then also be used to implement a more html like What are your thoughts on this? |
Hey @JakobHock Sure thing. You're welcome to implement
I think this could work, but as you mention, it's going to be more expensive computationally. Since some users will call this every frame, ideally, I think we should aim for a solution that doesn't require rendering. Otherwise, I noticed that Cientos is missing a That might be a good first issue, since it'll expose you to the other stuff that's involved in publishing a Cientos component – creating/updating a playground, writing docs/demos – without also being challenging to implement in its own right. And I personally find the shape components super handy and would like to have another! Let me know if that sounds good and I'll assign you so others don't duplicate your effort. Your call though. Thanks! |
Hello @andretchen0, I will hold off on implementing Anyway i will take you up on your offer to start with the Here is the Bounds: export type Bounds = {
/**
* Indicates if the bounds animation is playing. Is `true` even if the animation is paused.
*/
playing: ComputedRef<boolean>
/**
* Indicates if the bounds animation is paused.
*/
paused: ComputedRef<boolean>
/**
* Indicates if the bounds animation has finished.
*/
finished: ComputedRef<boolean>
/**
* The current progress of the animation. It is a number between 0 and 1.
*/
progress: ComputedRef<number>
/**
* Plays the animation according to the props given to the `<Bounds />` component. Camera controls if present are disabled during the animation.
*/
play: () => void
/**
* Pauses the animation. Does not enable camera controls.
*/
pause: () => void
/**
* Resumes the animation.
*/
resume: () => void
/**
* Skips the animation and sets the view immediately to the end.
*/
skip: () => void
/**
* Stops the animation and resets the the camera to the initial position.
*/
reset: () => void
/**
* Aborts the animation. Leaves the camera at the position at which the animation was aborted.
*/
abort: () => void
/**
* Callback function that is called when the animation starts.
*/
onStart: (callback: (startPosition: Vector3, endPosition: Vector3) => {}) => void
/**
* Callback function that is called when the animation ends.
*/
onEnd: (callback: (startPosition: Vector3, endPosition: Vector3) => {}) => void
} Props: export type BoundsProps = {
immediate?: boolean
margin?: number
duration?: number
interpolateFunc?: (t: number) => number
} |
@JakobHock , It's totally possible I'm misinterpreting what Drei's Good to hear about Cheers! |
Description
As a developer using TresJS, I would like to have a component that can keep child components centered on screen, even after screen resizes.
Suggested solution
A component that works like Drei's
<Bounds />
would be welcome.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: