File tree Expand file tree Collapse file tree
apps/typegpu-docs/src/examples/rendering/jelly-slider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -889,6 +889,7 @@ function createBindGroups() {
889889
890890let bindGroups = createBindGroups ( ) ;
891891
892+ let animationFrameHandle : number ;
892893function render ( timestamp : number ) {
893894 frameCount ++ ;
894895 camera . jitter ( ) ;
@@ -928,7 +929,7 @@ function render(timestamp: number) {
928929 . with ( bindGroups . render [ currentFrame ] )
929930 . draw ( 3 ) ;
930931
931- requestAnimationFrame ( render ) ;
932+ animationFrameHandle = requestAnimationFrame ( render ) ;
932933}
933934
934935function handleResize ( ) {
@@ -950,7 +951,7 @@ const resizeObserver = new ResizeObserver(() => {
950951} ) ;
951952resizeObserver . observe ( canvas ) ;
952953
953- requestAnimationFrame ( render ) ;
954+ animationFrameHandle = requestAnimationFrame ( render ) ;
954955
955956// #region Example controls and cleanup
956957
@@ -1067,6 +1068,7 @@ export const controls = {
10671068} ;
10681069
10691070export function onCleanup ( ) {
1071+ cancelAnimationFrame ( animationFrameHandle ) ;
10701072 resizeObserver . disconnect ( ) ;
10711073 root . destroy ( ) ;
10721074}
You can’t perform that action at this time.
0 commit comments