Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dev #64

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

Merged
takuma-hmng8 merged 2 commits into main from dev
Jan 20, 2024
Merged

Dev #64

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/ShaderFx.tsx
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const ShaderFx = ({ children }: { children: React.ReactNode }) => {
setDpr(Math.round((0.5 + 1.0 * factor) * 10) / 10);
}}>
<Suspense fallback={null}>{children}</Suspense>
{/* <Perf position={"bottom-left"} minimal={false} /> */}
<Perf position={"bottom-left"} minimal={false} />
</PerformanceMonitor>
</Canvas>
);
Expand Down
36 changes: 10 additions & 26 deletions app/domSyncer/DomSyncer.tsx
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,16 @@ export const DomSyncer = ({ state }: { state: number }) => {
);

const { setFrameloop } = useThree();
const isPlaying = useRef<boolean>(true);

useEffect(() => {
let id: number;
const filterIntersection = () => {
if (domSyncerObj.intersections.some((item) => item)) {
// どっかには交差してる
if (!isPlaying.current) {
setFrameloop("always");
isPlaying.current = true;
}
} else {
// どこにも交差してない
if (isPlaying.current) {
setFrameloop("never");
isPlaying.current = false;
}
}

id = requestAnimationFrame(filterIntersection);
};
id = requestAnimationFrame(filterIntersection);
return () => {
cancelAnimationFrame(id);
};
}, [domSyncerObj.intersections, setFrameloop]);
domSyncerObj.useDomView({
onView: () => {
console.log("play");
setFrameloop("always");
},
onHidden: () => {
console.log("stop");
setFrameloop("never");
},
});

const domArr = useRef<(HTMLElement | Element)[]>([]);
const contentArr = useRef<HTMLElement[]>([]);
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /