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

Zoom Pulse Mode #40

Merged
merged 1 commit into from Oct 27, 2017
Merged

Zoom Pulse Mode #40

merged 1 commit into from Oct 27, 2017

Conversation

@mbebenita
Copy link
Contributor

mbebenita commented Oct 25, 2017

Depends on #38

This PR adds a Zoom Pulse button to slowly zoom in and out the Text and SVG demo. The goal is to demonstrate how smooth rendering is.

image

@mbebenita
Copy link
Contributor Author

mbebenita commented Oct 25, 2017

I should mention that I couldn't find a good place to clear the setInterval, so the timer will keep going after the demo is unmounted. I'm not familiar with this UI toolkit, ... so ideas welcome.

@trishume
Copy link
Contributor

trishume commented Oct 25, 2017

This has the risk of the zooming looking choppy even if the underlying rendering isn't, because of the timer being de-synchronized from the frames. Probably better to use requestAnimationFrame for the animation, this may also solve your issue with unregistering the timer.

}
let c = 0;
let d = 0.005;
this.pulseTimer = window.setInterval(() => {

This comment has been minimized.

@pcwalton

pcwalton Oct 25, 2017

Collaborator

Please use requestAnimationFrame()

This comment has been minimized.

@mbebenita

mbebenita Oct 26, 2017

Author Contributor

Will do.

@@ -306,6 +311,10 @@ export class PerspectiveCamera extends Camera {
]);
}

zoom(scale: number): void {

This comment has been minimized.

@pcwalton

pcwalton Oct 25, 2017

Collaborator

Why this change?

This comment has been minimized.

@mbebenita

mbebenita Oct 26, 2017

Author Contributor

I wanted to keep the old zoom function private, but I needed something public that only took the scale argument. So I renamed the private function to _zoom and exposed the new function as zoom.

@mbebenita mbebenita force-pushed the mbebenita:pulse branch from e50c699 to 7039091 Oct 26, 2017
@mbebenita
Copy link
Contributor Author

mbebenita commented Oct 26, 2017

@trishume good idea, I switched to RAFs in the latest patch.

@pcwalton
Copy link
Collaborator

pcwalton commented Oct 27, 2017

Works for me.

@pcwalton pcwalton merged commit 591e6b7 into servo:master Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.