perf(movimento): vitrine e 3D mais leves, WebGL por software lembrado na sessão e suporte ao WebKit
This commit is contained in:
1 parent
9fd1570426
commit
8903f3c57e
28 files changed
+854
-406
No files matched your search
@@ -1,6 +1,10 @@
|
||||
import {
|
||||
easeToward,
|
||||
localAtProgress,
|
||||
locateInReel,
|
||||
REEL_HOLD,
|
||||
REEL_LAST_TAIL,
|
||||
reelHolds,
|
||||
reelStarts,
|
||||
videoProgress,
|
||||
} from "./showcase-math";
|
||||
@@ -41,6 +45,34 @@ describe("videoProgress", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("videoProgress with a shorter pause at the end", () => {
|
||||
it("lets the video run until the tail starts", () => {
|
||||
expect(videoProgress(0.9, 0.1, 0.03)).toBeCloseTo((0.9 - 0.1) / 0.87, 9);
|
||||
expect(videoProgress(0.97, 0.1, 0.03)).toBe(1);
|
||||
expect(videoProgress(1, 0.1, 0.03)).toBe(1);
|
||||
expect(videoProgress(0.1, 0.1, 0.03)).toBe(0);
|
||||
});
|
||||
|
||||
it("localAtProgress is its inverse inside the moving part", () => {
|
||||
for (const progress of [0, 0.25, 0.5, 1]) {
|
||||
const local = localAtProgress(progress, 0.1, 0.03);
|
||||
expect(videoProgress(local, 0.1, 0.03)).toBeCloseTo(progress, 9);
|
||||
}
|
||||
expect(localAtProgress(0)).toBe(REEL_HOLD);
|
||||
expect(localAtProgress(1)).toBeCloseTo(1 - REEL_HOLD, 9);
|
||||
});
|
||||
});
|
||||
|
||||
describe("reelHolds", () => {
|
||||
it("keeps the full pause everywhere but at the end of the last project, which has nothing to wait for", () => {
|
||||
expect(reelHolds(0, 4)).toEqual({ head: REEL_HOLD, tail: REEL_HOLD });
|
||||
expect(reelHolds(2, 4)).toEqual({ head: REEL_HOLD, tail: REEL_HOLD });
|
||||
expect(reelHolds(3, 4)).toEqual({ head: REEL_HOLD, tail: REEL_LAST_TAIL });
|
||||
expect(REEL_LAST_TAIL).toBeLessThan(REEL_HOLD);
|
||||
expect(reelHolds(0, 1).tail).toBe(REEL_LAST_TAIL);
|
||||
});
|
||||
});
|
||||
|
||||
describe("easeToward", () => {
|
||||
it("moves toward the target and never overshoots", () => {
|
||||
const first = easeToward(0, 1, 1 / 60);
|
||||
|
||||
Reference in new issue
Block a user