Checkpoint flip page dimensions

This commit is contained in:
2026-06-05 11:48:01 +02:00
parent b5c2f9fa42
commit 467842ba0b
2 changed files with 6 additions and 15 deletions
+5 -14
View File
@@ -1027,8 +1027,8 @@ function updateActiveFlips(now) {
function buildFlippingPageSurface(sourceLine, destinationLine, direction, t, pageOffset = 0) {
const widthSegments = sourceLine.points.length - 1;
const depthSegments = 18;
const zFront = lastBookModel.pageDepth * 0.5 + 0.018;
const zBack = -lastBookModel.pageDepth * 0.5 - 0.018;
const zFront = lastBookModel.pageDepth * 0.5;
const zBack = -lastBookModel.pageDepth * 0.5;
if (t <= 0) return createRestingPageSurface(sourceLine.points, depthSegments, zFront, zBack);
if (t >= 1) return createRestingPageSurface(destinationLine.points, depthSegments, zFront, zBack);
@@ -1039,11 +1039,12 @@ function buildFlippingPageSurface(sourceLine, destinationLine, direction, t, pag
const baseAngle = startAngle + direction * Math.PI * t;
const lift = Math.sin(Math.PI * t);
const curlStrength = direction * 0.48 * lift;
const sourceLengths = cumulativeLineLengths(sourceLine.points);
const sourceAnchor = sourceLine.anchor;
const surface = [];
for (let widthIndex = 0; widthIndex <= widthSegments; widthIndex += 1) {
const u = widthIndex / widthSegments;
const radius = sourceLengths[widthIndex];
const sourcePoint = sourceLine.points[widthIndex];
const radius = Math.max(0, sourceSide * (sourcePoint.x - sourceAnchor.x));
const row = [];
for (let depthIndex = 0; depthIndex <= depthSegments; depthIndex += 1) {
const v = depthIndex / depthSegments;
@@ -1066,16 +1067,6 @@ function buildFlippingPageSurface(sourceLine, destinationLine, direction, t, pag
return surface;
}
function cumulativeLineLengths(points) {
const lengths = [0];
for (let index = 1; index < points.length; index += 1) {
const previous = points[index - 1];
const current = points[index];
lengths.push(lengths[index - 1] + Math.hypot(current.x - previous.x, current.y - previous.y));
}
return lengths;
}
function createRestingPageSurface(points, depthSegments, zFront, zBack) {
return points.map((point) => {
const row = [];
+1 -1
View File
@@ -74,6 +74,6 @@
<button id="fast_forward" type="button">Fast Forward</button>
<output id="flip_count">0 / 10</output>
</div>
<script type="module" src="/js/webgl-book-shape-lab.js?v=packed-spine-seam-2"></script>
<script type="module" src="/js/webgl-book-shape-lab.js?v=flip-sheet-dimensions-1"></script>
</body>
</html>