This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @returns Average of an array | |
*/ | |
export function getAverage(arr) { | |
let sum = 0; | |
for (let index = 0; index < arr.length; index++) { | |
sum = sum + arr[index]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Forked from: https://github.com/erosmarcon/three-steer | |
import { Vector3, Group, Box3, Raycaster } from 'three'; | |
Object.defineProperty(Vector3.prototype, 'angle', { | |
enumerable: true, | |
configurable: true, | |
get: function () { | |
return Math.atan2(this.z, this.x); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { exec } from 'child_process'; | |
import fs from 'fs'; | |
import path from 'path'; | |
// This script compresses a single PNG or JPG texture to KTX2 using the Khronos toktx tool. | |
// Uses low quality but highly compressed ETC1S compression by default. | |
// Feel free to extend it! | |
// REQUIREMENTS: | |
// Install toktx 4.3.1 from https://github.com/KhronosGroup/KTX-Software/releases/tag/v4.3.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// InstancedMesh helpers | |
// | |
import { | |
BufferAttribute, | |
InstancedBufferGeometry, | |
InstancedMesh, | |
Matrix4, | |
Vector3, | |
Vector4, | |
} from "three" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { IndexProjectsPageData } from "types/back" | |
import React, { useEffect, useMemo, useState } from "react" | |
import { Texture, TextureLoader } from "three" | |
import InfiniteSlider from "@components/CanvasGL/InfiniteSlider" | |
import { makeButton, useTweaks } from "use-tweaks" | |
import random from "canvas-sketch-util/random" | |
import { Slide } from "../InfiniteSlider/types" | |
const ProjectsCanvas = ({ pageProps: { allProjects } }: { pageProps: IndexProjectsPageData }) => { | |
// State |