repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/FollowerEntity.js
13_Nowherelands/js/entities/FollowerEntity.js
function FollowerEntity(entity, player, collisionManager) { const forwardVector = new THREE.Vector3(); // const entities = entity.entities; this.update = function(time) { player.controls.getDirection(forwardVector); forwardVector.multiplyScalar(60); for(let i=0; i<entity.entities.length; i++) { c...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/EntitiesSpawner.js
13_Nowherelands/js/entities/EntitiesSpawner.js
function EntitiesSpawner(scene, player, collisionManager, terrainSize, cubeCamera) { const cylinders = new FollowerEntity(new Cylinders(scene), player, collisionManager); const grass = new FollowerEntity(new Grass(scene), player, collisionManager); const trees = new FollowerEntity(new Trees(scene), player, collisio...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/ElusiveEntity.js
13_Nowherelands/js/entities/ElusiveEntity.js
function ElusiveEntity(scene, player, collisionManager) { const radius = 2; const mesh = new THREE.Mesh(new THREE.OctahedronBufferGeometry(radius, 0), new THREE.MeshToonMaterial()); mesh.position.set(0, 1, -200); scene.add(mesh); mesh.animationInProgress = false; collisionManager.objects.push(mesh); const ligh...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/Sprouts.js
13_Nowherelands/js/entities/Sprouts.js
function Sprouts(scene, player, collisionManager, terrainSize) { const self = this; const group = new THREE.Group(); const ball = new THREE.Mesh(new THREE.IcosahedronBufferGeometry(4, 1), new THREE.MeshToonMaterial({color: "#ffffff"})); const leafGeometry = buildLeafGeometry() const leafVertices = [leafGeometr...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/Trees.js
13_Nowherelands/js/entities/Trees.js
function Trees(scene) { const self = this; this.minRadius = 160; this.maxRadius = 260; this.maxDistance = 265; this.height = 220; this.entities = []; var material = new THREE.MeshStandardMaterial({ color: "#000", roughness: .5, metalness: .5, flatShading: true }); var loader = new THREE.JSONLoader(); ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/Mirrors.js
13_Nowherelands/js/entities/Mirrors.js
function Mirrors(scene, player, collisionManager, terrainSize, cubeCamera) { const material = new THREE.MeshBasicMaterial({color:"#fff", side: THREE.DoubleSide, flatShading: true }) material.envMap = cubeCamera.renderTarget.texture; const square = new THREE.Mesh(new THREE.CircleBufferGeometry(20, 4), material); c...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/Cylinders.js
13_Nowherelands/js/entities/Cylinders.js
function Cylinders(scene) { const self = this; this.minRadius = 80; this.maxRadius = 160; this.maxDistance = 180; this.height = 15; this.entities = []; const cylinderGeometry = new THREE.CylinderBufferGeometry(2, 2, this.height, 6); const wireframe = new THREE.LineSegments( new THREE.EdgesGeomet...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/entities/Grass.js
13_Nowherelands/js/entities/Grass.js
function Grass(scene) { this.minRadius = 40; this.maxRadius = 160; this.maxDistance = 180; this.height = 4; this.entities = []; const grassBlueprint = new THREE.LineSegments( new THREE.EdgesGeometry( new THREE.CylinderBufferGeometry(.2, .4, this.height, 2) ), new THREE.LineBasicMaterial() ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/monoliths/TuneMonolith.js
13_Nowherelands/js/monoliths/TuneMonolith.js
const tuneMonolithClick = "tuneMonolithClick"; function TuneMonolith(geometry, baseSize, scene, collisionManager, index) { const self = this; this.size = baseSize; this.mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial({color: 0x00ff00, flatShading: true}) ); this.mesh.material.color.setHSL(getRa...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/monoliths/TimeMonolith.js
13_Nowherelands/js/monoliths/TimeMonolith.js
const toggleTime = "toggleTime"; function TimeMonolith(scene, collisionManager, terrainSize, cubeCamera) { const group = new THREE.Group(); group.position.set(-500, 0, -500); // group.position.set(0, 0, -100); group.scale.set(5, 5, 5); const cylinder = new THREE.Mesh(new THREE.CylinderBufferGeometry(1, 1, 1, 6)...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/monoliths/TuneMonolithGroup.js
13_Nowherelands/js/monoliths/TuneMonolithGroup.js
function TuneMonolithGroup(scene, collisionManager, terrainSize) { const subjects = []; const baseSize = 5; var geometry = new THREE.BoxGeometry(baseSize, baseSize*2, baseSize); geometry.vertices[0].y /= 1.2 geometry.vertices[1].y /= 1.2 const xOffset = getRandom(-terrainSize/12, terrainSize/20); const zOffse...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/monoliths/Octahedrons.js
13_Nowherelands/js/monoliths/Octahedrons.js
function Octahedrons(scene, collisionManager, terrainSize, cubeCamera) { const octahedrons = []; const material = new THREE.MeshBasicMaterial(); material.envMap = cubeCamera.renderTarget.texture; for(let i=0; i<4; i++) { const x = getRandom(-terrainSize/8, terrainSize/12); const z = getRandom(-terrainSize/8,...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/monoliths/MonolithsSpawner.js
13_Nowherelands/js/monoliths/MonolithsSpawner.js
function MonolithsSpawner(scene, player, collisionManager, terrainSize, cubeCamera) { const monoliths = []; monoliths.push(new TuneMonolithGroup(scene, collisionManager, terrainSize)) monoliths.push(new Octahedrons(scene, collisionManager, terrainSize, cubeCamera)) monoliths.push(new TimeMonolith(scene, collisionM...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/cameraControls/PointerLockManager.js
13_Nowherelands/js/cameraControls/PointerLockManager.js
function PointerLockManager(camera, scene, collisionManager) { let controls; const blocker = document.getElementById( 'blocker' ); const instructions = document.getElementById( 'instructions' ); const havePointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockEl...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/terrain/EndlessTerrain.js
13_Nowherelands/js/terrain/EndlessTerrain.js
function EndlessTerrain(scene, viewer, chunkSize) { const maxViewDistance = 450; const mapGenerator = new MapGenerator(200, 5, .5, 2, 0, [0, 0]); const viewerPosition = new THREE.Vector2(); const chunksVisibleInViewDistance = Math.round(maxViewDistance / chunkSize); const terrainChunkDictionary = {}; const ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/terrain/Noise.js
13_Nowherelands/js/terrain/Noise.js
function Noise() { this.generateNoiseMap = function(mapWidth, mapHeight, seed, scale, octaves, persistance, lacunarity, offset) { noiseMap = []; const prng = new Random(seed); const simplex = new SimplexNoise(prng); const octavesOffsets =[]; for(let i=0; i<octaves; i++) { octavesOffsets.push( [ prng....
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/terrain/MapGenerator.js
13_Nowherelands/js/terrain/MapGenerator.js
function MapGenerator(noiseScale, octaves, persistance, lacunarity, seed, offset, useFalloff) { const mapChunkSize = 441; this.size = mapChunkSize; const noise = new Noise(); let falloffMap; if(useFalloff) falloffMap = new FalloffGenerator().generateFalloffMap(mapChunkSize); this.generateMap = function() ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/terrain/TerrainMeshGenerator.js
13_Nowherelands/js/terrain/TerrainMeshGenerator.js
function TerrainMeshGenerator() { this.generateTerrainMesh = function(heightMap, smoothThreshold, heightMultiplier, levelOfDetail) { if(levelOfDetail < 1 || levelOfDetail > 6) { console.error("levelOfDetail out of range"); return; } const width = heightMap.length; const height = heightMap[0].length; ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/terrain/Terrain.js
13_Nowherelands/js/terrain/Terrain.js
function Terrain(scene, cubecamera) { const mapGenerator = new MapGenerator(150, 5, .5, 2, 0, [0, 0], true); const map = mapGenerator.generateMap(); const scale = 15; // terrain const mesh = new TerrainMeshGenerator().generateTerrainMesh(map, .4, 15, 2).createMesh(cubecamera); mesh.scale.set(...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/terrain/FalloffGenerator.js
13_Nowherelands/js/terrain/FalloffGenerator.js
function FalloffGenerator() { this.generateFalloffMap = function(size) { const map = []; for(let i=0; i<size; i++) { map.push([]); for(let j=0; j<size; j++) { const x = i/size * 2 -1; const y = j/size * 2 -1; const value = Math.max(Math.abs(x), Math.abs(y)); map[i].push( evaluate(value) )...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/terrain/TerrainCollisionManager.js
13_Nowherelands/js/terrain/TerrainCollisionManager.js
function TerrainCollisionManager(terrain) { this.objects = []; const down = new THREE.Vector3(0, -1, 0); const raycaster = new THREE.Raycaster(new THREE.Vector3(0, 400, 0), down) this.getY = function(x, z) { raycaster.ray.origin.set(x, 400, z); const collisionResults = raycaster.inters...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/13_Nowherelands/js/libs/PointerLockControls.js
13_Nowherelands/js/libs/PointerLockControls.js
/** * @author mrdoob / http://mrdoob.com/ */ THREE.PointerLockControls = function ( camera ) { var scope = this; camera.rotation.set( 0, 0, 0 ); var pitchObject = new THREE.Object3D(); pitchObject.add( camera ); var yawObject = new THREE.Object3D(); yawObject.position.y = 10; yawObject.add( pitchObject );...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/09_EyeBall/js/SceneManager.js
09_EyeBall/js/SceneManager.js
function SceneManager(canvas) { canvas.width = document.body.clientWidth; canvas.height = document.body.clientHeight; var time = 0; var mousePosition = { x: 0, y: 0, disabled: true }; var width = canvas.width; var height = canvas.height; var scene = new THREE.S...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/09_EyeBall/js/main.js
09_EyeBall/js/main.js
var canvas = document.getElementById("canvas"); var windowHalfX = window.innerWidth / 2; var windowHalfY = window.innerHeight / 2; window.onresize = resizeCanvas; resizeCanvas(); var sceneManager = new SceneManager(canvas); render(); window.onmousemove = onMouseMove; function render() { requestAnimationFrame(...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/09_EyeBall/js/Background.js
09_EyeBall/js/Background.js
function Background(scene) { var backgroundGeometry = new THREE.IcosahedronGeometry(20, 0); var backgroundMaterial = new THREE.MeshStandardMaterial({ color: "#000000", roughness: 1, metalness: .5, flatShading: false, side: THREE.BackSide }); var background = new THREE.Mesh(backgroundGeometry, backgroundMate...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/09_EyeBall/js/Utils.js
09_EyeBall/js/Utils.js
function getRandom(min, max) { return Math.random() * (max - min) + min; }
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/09_EyeBall/js/Sphere.js
09_EyeBall/js/Sphere.js
function Sphere(scene) { // deformed sphere var icoGeometry = new THREE.IcosahedronGeometry(1.5, 2); var icoMaterial = new THREE.MeshBasicMaterial({ color: "#000", wireframe: false }); var baseSphere = new THREE.Mesh(icoGeometry, icoMaterial); scene.add(baseSphere); var envMap = new THREE.Text...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/04_SoUNds/js/Draw.js
04_SoUNds/js/Draw.js
function Draw (lineNumber) { var self = this; var state = { pixelRatio: -1, strokeStyleCicrle: -1, strokeStyleLine: -1, color: -1, palette: null, centerX: -1, centerY: -1, radius: -1 } var stage = new createjs.Stage("demoCanvas"); var circl...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/04_SoUNds/js/SoundGenerator.js
04_SoUNds/js/SoundGenerator.js
function SoundGenerator(fftSize) { // var audio = new Audio(); // audio.src = "song2.mp3"; // audio.load(); window.context = window.context || window.webkitcontext; var context = new AudioContext(); var notesArray = getNotes(); var analyser = context.createAnalyser(); analyser.smoothi...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/05_GrassSimulator/js/GrassSceneSubject.js
05_GrassSimulator/js/GrassSceneSubject.js
function GrassSceneSubject(scene) { var lines = new Array(); var palette = [ new THREE.LineBasicMaterial( { color: "#081C0A" } ), new THREE.LineBasicMaterial( { color: "#103712" } ), new THREE.LineBasicMaterial( { color: "#1B5E20" } ), new THREE.LineBasicMaterial( { color: "#...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/05_GrassSimulator/js/SceneManager.js
05_GrassSimulator/js/SceneManager.js
function SceneManager(canvas) { canvas.width = document.body.clientWidth; canvas.height = document.body.clientHeight; var time = 0; var width = canvas.width; var height = canvas.height; var scene = new THREE.Scene(); scene.background = new THREE.Color("#202020"); var light = buildLigh...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/05_GrassSimulator/js/main.js
05_GrassSimulator/js/main.js
var canvas = document.getElementById("canvas"); window.onresize = resizeCanvas; resizeCanvas(); var sceneManager = new SceneManager(canvas); render(); function render() { requestAnimationFrame(render); sceneManager.update(); } function resizeCanvas() { var canvas = document.getElementById("canvas"); ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/05_GrassSimulator/js/BallSceneSubject.js
05_GrassSimulator/js/BallSceneSubject.js
function BallSceneSubject(scene) { var geometry = new THREE.SphereGeometry(0.5, 64, 64); var material = new THREE.MeshStandardMaterial({ color: "#000", roughness: 1 }); // these images are loaded as data uri. Just copy and paste the string contained in "image.src" in your browser's url bar to see ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/20_flow/perlin.js
20_flow/perlin.js
/* * A speed-improved perlin and simplex noise algorithms for 2D. * * Based on example code by Stefan Gustavson (stegu@itn.liu.se). * Optimisations by Peter Eastman (peastman@drizzle.stanford.edu). * Better rank ordering method by Stefan Gustavson in 2012. * Converted to Javascript by Joseph Gentle. * * Version...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/20_flow/main.js
20_flow/main.js
function onLoad() { window.onresize = onResize const canvas = document.getElementById("canvas") const screenInfo = { pixelRatio: getPixelRatio(canvas.getContext('2d')), width: -1, height: -1 } resizeCanvas() const flow = new Flow(canvas, screenInfo) let time = 0 render() function r...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/20_flow/flow.js
20_flow/flow.js
function Flow(canvas, screenInfo) { const context = canvas.getContext("2d") const circleRadius = Math.min(screenInfo.height, screenInfo.width)/2.5 noise.seed(Math.random()) const particles = [] for (let angle = 0; angle < Math.PI * 2; angle += 0.001) { const x = circleRadius * Math.cos(angle) + screenI...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/17_SquidPeople/js/SceneManager.js
17_SquidPeople/js/SceneManager.js
function SceneManager(canvas) { const clock = new THREE.Clock(); const screenDimensions = { width: canvas.width, height: canvas.height } const scene = buildScene(); const renderer = buildRender(screenDimensions); const camera = buildCamera(screenDimensions); const ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/17_SquidPeople/js/main.js
17_SquidPeople/js/main.js
const canvas = document.getElementById("canvas"); const sceneManager = new SceneManager(canvas); bindEventListeners(); render(); function bindEventListeners() { window.onresize = resizeCanvas; resizeCanvas(); } function resizeCanvas() { canvas.style.width = '100%'; canvas.style.height= '100%'; canvas.width ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/17_SquidPeople/js/utils.js
17_SquidPeople/js/utils.js
Function.prototype.inheritsFrom = function(parentClassOrObject) { if(parentClassOrObject.constructor == Function) { //Normal Inheritance this.prototype = new parentClassOrObject; this.prototype.constructor = this; this.prototype.parent = parentClassOrObject.prototype; } e...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/17_SquidPeople/js/sceneSubjects/SceneSubject.js
17_SquidPeople/js/sceneSubjects/SceneSubject.js
function SceneSubject(scene) { const self = this; this.group = new THREE.Group(); this.group.position.set(0,0,-5); scene.add(this.group); const squidz = new Array(); const squidGuy = new SquidGuy(); this.group.add(squidGuy.group); squidz.push(squidGuy); const squidGuy2 = new SquidGuy(); squidGuy2.group.s...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/17_SquidPeople/js/sceneSubjects/GeneralLights.js
17_SquidPeople/js/sceneSubjects/GeneralLights.js
function GeneralLights(scene) { const light = new THREE.PointLight("#fff", .4); scene.add(light); this.update = function(time) { // light.intensity = (Math.sin(time)+1.5)/1.5; // light.color.setHSL( Math.sin(time), 0.5, 0.5 ); } }
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/PointsEmitter.js
03_WTPlayer/js/PointsEmitter.js
function PointsEmitter (origin, target, stage) { var self = this; this.origin = origin; this.target = target; this.speed = 0.002; this.startColorAnimations = false; this.vector = { x: (target.x - origin.x), y: (target.y - origin.y) }; this.numberOfParticles = 40; this.particles = new Array(this.numberOfPa...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/Rain.js
03_WTPlayer/js/Rain.js
function Rain (stage) { var self = this; // theres a bug, canvas width and height are doubled :||| this.width = mBackgroundManager.canvas.width/2; this.height = mBackgroundManager.canvas.height/2; this.speed = this.height/500; this.length = 15; this.thickness = 5; this.numberOfParticles = 30; this.verticalD...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/SceneManager.js
03_WTPlayer/js/SceneManager.js
function SceneManager () { var self = this; // screen info this.HEIGHT; this.WIDTH; this.aspectRatio; this.nearPlane; this.farPlane; this.mainScene; this.camera; this.renderer; // raycasting this.raycaster; this.mousePosition; } SceneManager.prototype.init = function(callback) { var self = this; //...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/BackgroundManager.js
03_WTPlayer/js/BackgroundManager.js
function BackgroundManager () { var self = this; // [0] = light purple, [1] = dark purple // [2] = light blue, [3] = dark blue this.palette = ["#4D5B7E", "#2B385C", "#286F8D", "#0A5676"]; this.backgroundColor = "#FF8004"; this.stage; this.canvas = document.getElementById("baseCanvas"); this.circles = new Arr...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/BackgroundExplosion.js
03_WTPlayer/js/BackgroundExplosion.js
function BackgroundExplosion (stage) { var self = this; this.stage = stage; // theres a bug, canvas width and height are doubled :||| this.width = mBackgroundManager.canvas.width/2; this.height = mBackgroundManager.canvas.height/2; this.explosionSpeed = this.height/20; this.circleSpeed = this.height/60; th...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/SceneObject.js
03_WTPlayer/js/SceneObject.js
function SceneObject (size, color) { var self = this; this.size = size; var color = color; // must be instantiated in the constructor this.baseMesh; this.wireframeMesh; this.showWireframe = true; this.beahviour; this.orbit; this.parent; this.children = new Array(); this.objects = new Array(); this.in...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/MouseManager.js
03_WTPlayer/js/MouseManager.js
function MouseManager () { var self = this; this.position = { x: 0, y: 0}; }; MouseManager.prototype.onMouseMove = function(event) { this.position.x = event.clientX; this.position.y = event.clientY; };
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/SoundManager.js
03_WTPlayer/js/SoundManager.js
function SoundManager () { var self = this; this.context; try { window.AudioContext = window.AudioContext || window.webkitAudioContext; this.context = new AudioContext(); } catch(e) { alert('Web Audio API is not supported in this browser'); } this.analyser = this.context.createAnalyser(); this.analyser.sm...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/ModelsManager.js
03_WTPlayer/js/ModelsManager.js
function ModelsManager () { var self = this; // 1 = first level songs, 2 = second level songs, 3 = third level songs, 4 = other obj var rootColor = "#fff"; var palette = ["#f44336"]; var sizes = [60, 1, 5]; this.model; // privileged this.init = function (callback) { loadModel(); // done loading callba...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/Behaviour.js
03_WTPlayer/js/Behaviour.js
function Beahviour (sceneObject) { var self = this; this.palette = new Array(); // init palette // red this.palette.push(["#f44336", 0]); //pink this.palette.push(["#E91E63", 100]); // purple this.palette.push(["#9C27B0", 200]); // deep purple this.palette.push(["#673AB7", 300]); // indigo this.palette.pu...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/03_WTPlayer/js/Orbit.js
03_WTPlayer/js/Orbit.js
function Orbit (sceneObject) { var self = this; // precondition if(sceneObject == null) throw new Error("Orbit(sceneObject): sceneObject == null"); this.sceneObject = sceneObject; var orbitRadiusFactor = 1 +Math.random()/2; this.orbitRadius = sceneObject.parent.size * orbitRadiusFactor; this.orbitCenter; ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/SceneManager.js
16_Lines/js/SceneManager.js
function SceneManager(canvas) { const clock = new THREE.Clock(); const screenDimensions = { width: canvas.width, height: canvas.height } const scene = buildScene(); const renderer = buildRender(screenDimensions); const camera = buildCamera(screenDimensions); const ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/main.js
16_Lines/js/main.js
const canvas = document.getElementById("canvas"); const sceneManager = new SceneManager(canvas); bindEventListeners(); render(); function bindEventListeners() { window.onresize = resizeCanvas; resizeCanvas(); } function resizeCanvas() { canvas.style.width = '100%'; canvas.style.height= '100%'; canvas.width ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/Utils.js
16_Lines/js/Utils.js
function getRandom(min, max) { return Math.random() * (max - min) + min; } function getRandomInt(min, max) { return Math.round(Math.random() * (max - min) + min); } function clamp01(value) { return Math.min(Math.max(value, 0), 1); } function shadeColor(color, percent) { var R = parseInt(color.subst...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/sceneSubjects/TerrainSubject.js
16_Lines/js/sceneSubjects/TerrainSubject.js
function TerrainSubject(scene) { const terrain = new Terrain(); terrain.mesh.rotation.y = Math.PI/2; // scene.add(terrain.mesh); var size = 100; var divisions = 10; var gridHelper = new THREE.GridHelper( size, divisions ); scene.add( gridHelper ); this.update = function(time) { } }
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/sceneSubjects/PlaneSubject.js
16_Lines/js/sceneSubjects/PlaneSubject.js
function PlaneSubject(scene, indx, noiseMap, fallOff) { const widthSegments = noiseMap.length-1; var geometry = new THREE.PlaneGeometry( widthSegments/2, 0.1, widthSegments ); const heights = getHeights(widthSegments+1, 20); const vertices = geometry.vertices; for(let i=0; i<widthSegments+1; i++)...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/sceneSubjects/PlanesSubject.js
16_Lines/js/sceneSubjects/PlanesSubject.js
function PlanesSubject(scene) { const size = 256; const mapGenerator = new MapGenerator(size, 150, 10, .9, 2, 1, [0, 0], false); const map = mapGenerator.generateMap(); const fallOff = buildFallOff(size+1) for(let i=0; i<100; i++) { const p = new PlaneSubject(scene, i, map, fallOff); ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/sceneSubjects/SceneSubject.js
16_Lines/js/sceneSubjects/SceneSubject.js
function SceneSubject(scene) { const radius = 2; const mesh = new THREE.Mesh(new THREE.CircleBufferGeometry(radius, 16), new THREE.MeshBasicMaterial( { color: "#000" } ) ); mesh.position.set(0, 0, -20); scene.add(mesh); this.update = function(time) { const scale = Math.sin(time)+2; mesh.scale.set(sca...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/sceneSubjects/GeneralLights.js
16_Lines/js/sceneSubjects/GeneralLights.js
function GeneralLights(scene) { const light = new THREE.PointLight("#2222ff", 1); // scene.add(light); this.update = function(time) { } }
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/terrain/Noise.js
16_Lines/js/terrain/Noise.js
function Noise() { this.generateNoiseMap = function(mapWidth, mapHeight, seed, scale, octaves, persistance, lacunarity, offset) { noiseMap = []; const prng = new Random(seed); const simplex = new SimplexNoise(prng); const octavesOffsets =[]; for(let i=0; i<octaves; i++) { octavesOffsets.push( [ prng....
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/terrain/MapGenerator.js
16_Lines/js/terrain/MapGenerator.js
function MapGenerator(size, noiseScale, octaves, persistance, lacunarity, seed, offset, useFalloff) { const mapChunkSize = size; this.size = mapChunkSize; const noise = new Noise(); let falloffMap; if(useFalloff) falloffMap = new FalloffGenerator().generateFalloffMap(mapChunkSize); this.generateMap = func...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/terrain/TerrainMeshGenerator.js
16_Lines/js/terrain/TerrainMeshGenerator.js
function TerrainMeshGenerator() { this.generateTerrainMesh = function(heightMap, smoothThreshold, heightMultiplier, levelOfDetail) { if(levelOfDetail < 1 || levelOfDetail > 6) { console.error("levelOfDetail out of range"); return; } const width = heightMap.length; const height = heightMap[0].length; ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/terrain/Terrain.js
16_Lines/js/terrain/Terrain.js
function Terrain() { const mapGenerator = new MapGenerator(150, 5, .5, 2, 0, [0, 0], true); const map = mapGenerator.generateMap(); const scale = 1; const mesh = new TerrainMeshGenerator().generateTerrainMesh(map, .4, 15, 2).createMesh(); mesh.scale.set(scale, scale, scale); const terrainWir...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/16_Lines/js/terrain/FalloffGenerator.js
16_Lines/js/terrain/FalloffGenerator.js
function FalloffGenerator() { this.generateFalloffMap = function(size) { const map = []; for(let i=0; i<size; i++) { map.push([]); for(let j=0; j<size; j++) { const x = i/size * 2 -1; const y = j/size * 2 -1; const value = Math.max(Math.abs(x), Math.abs(y)); map[i].push( evaluate(value) )...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/SceneManager.js
10_BrokenMantra/js/SceneManager.js
function SceneManager(canvas) { canvas.width = document.body.clientWidth; canvas.height = document.body.clientHeight; var time = 0; var clock = new THREE.Clock(); var mousePosition = { x: 0, y: 0, disabled: true }; var width = canvas.width; var height = canvas.hei...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/main.js
10_BrokenMantra/js/main.js
var canvas = document.getElementById("canvas"); var windowHalfX = window.innerWidth / 2; var windowHalfY = window.innerHeight / 2; window.onresize = resizeCanvas; resizeCanvas(); var musicManager = new MusicManager(); var sceneManager = new SceneManager(canvas); musicManager.onSongLoaded = () => { musicManager.play...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/Heads.js
10_BrokenMantra/js/Heads.js
function Heads(scene) { var self = this; var group = new THREE.Group(); var lookAt = false; var head; var material = new THREE.MeshStandardMaterial({ color: "#000", roughness: .5, metalness: .5, flatShading: true }); var cols = new Array(); var loader = new THREE.JSONLoader(); loader.l...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/Head.js
10_BrokenMantra/js/Head.js
function Head(scene) { var self = this; var deform = false; var head, wireframe; var material = new THREE.MeshStandardMaterial({ color: "#000", roughness: .5, metalness: .5, flatShading: false }); var vertices = new Array(); var loader = new THREE.JSONLoader(); loader.load('head.json', f...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/Background.js
10_BrokenMantra/js/Background.js
function Background(scene) { var backgroundGeometry = new THREE.IcosahedronGeometry(40, 0); var backgroundMaterial = new THREE.MeshStandardMaterial({ color: "#000000", roughness: 1, metalness: .5, flatShading: false, side: THREE.BackSide }); var background = new THREE.Mesh(backgroundGeometry, backgroundMate...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/Utils.js
10_BrokenMantra/js/Utils.js
function getRandom(min, max) { return Math.random() * (max - min) + min; }
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/MusicManager.js
10_BrokenMantra/js/MusicManager.js
/** * [MusicManager Class responsible for music playback and sond analysis] */ function MusicManager() { const self = this; var isVolumeOn = true; var isPlaying = true; var audio var context, analyser, mediaElementSource; // this gives problems on firefox T_T should be fixed with future vers...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/Cubes.js
10_BrokenMantra/js/Cubes.js
function Cubes(scene) { var group = new THREE.Group(); var size = .5; var geometry = new THREE.BoxGeometry( 1, 1, 1 ); var material = new THREE.MeshStandardMaterial({ color: "#000", roughness: 1, metalness: .8, flatShading: false }); var roughnessMap = new THREE.TextureLoader().load("textures/rough...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/Eyes.js
10_BrokenMantra/js/Eyes.js
function Eyes(scene) { var group = new THREE.Group(); var show = false; var size = .5; var icoGeometry = new THREE.IcosahedronGeometry(1.5, 2); var icoMaterial = new THREE.MeshBasicMaterial({ color: "#000", wireframe: false }); var baseSphere = new THREE.Mesh(icoGeometry, icoMaterial); // ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/Pyramid.js
10_BrokenMantra/js/Pyramid.js
function Pyramid(scene) { var group = new THREE.Group(); var size = 1.5; var pyramidGeometry = new THREE.CylinderGeometry( 0, size, size*1.5, 4, 1 ); var material = new THREE.MeshStandardMaterial({ color: "#000", roughness: 1, metalness: .8, flatShading: false }); var roughnessMap = new THREE.Textu...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/shaders/FilmShader.js
10_BrokenMantra/js/libs/shaders/FilmShader.js
/** * @author alteredq / http://alteredqualia.com/ * * Film grain & scanlines shader * * - ported from HLSL to WebGL / GLSL * http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html * * Screen Space Static Postprocessor * * Produces an analogue noise overlay simi...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/shaders/DigitalGlitch.js
10_BrokenMantra/js/libs/shaders/DigitalGlitch.js
/** * @author felixturner / http://airtight.cc/ * * RGB Shift Shader * Shifts red and blue channels from center in opposite directions * Ported from http://kriss.cx/tom/2009/05/rgb-shift/ * by Tom Butterworth / http://kriss.cx/tom/ * * amount: shift distance (1 is width of input) * angle: shift angle in radian...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/shaders/CopyShader.js
10_BrokenMantra/js/libs/shaders/CopyShader.js
/** * @author alteredq / http://alteredqualia.com/ * * Full-screen textured quad shader */ THREE.CopyShader = { uniforms: { "tDiffuse": { value: null }, "opacity": { value: 1.0 } }, vertexShader: [ "varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelVi...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/postprocessing/GlitchPass.js
10_BrokenMantra/js/libs/postprocessing/GlitchPass.js
/** * @author alteredq / http://alteredqualia.com/ */ THREE.GlitchPass = function ( dt_size ) { THREE.Pass.call( this ); if ( THREE.DigitalGlitch === undefined ) console.error( "THREE.GlitchPass relies on THREE.DigitalGlitch" ); var shader = THREE.DigitalGlitch; this.uniforms = THREE.UniformsUtils.clone( shad...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/postprocessing/FilmPass.js
10_BrokenMantra/js/libs/postprocessing/FilmPass.js
/** * @author alteredq / http://alteredqualia.com/ */ THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale ) { THREE.Pass.call( this ); if ( THREE.FilmShader === undefined ) console.error( "THREE.FilmPass relies on THREE.FilmShader" ); var shader = THREE.FilmShader; thi...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/postprocessing/RenderPass.js
10_BrokenMantra/js/libs/postprocessing/RenderPass.js
/** * @author alteredq / http://alteredqualia.com/ */ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) { THREE.Pass.call( this ); this.scene = scene; this.camera = camera; this.overrideMaterial = overrideMaterial; this.clearColor = clearColor; this.clearAlpha = ( clea...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/postprocessing/EffectComposer.js
10_BrokenMantra/js/libs/postprocessing/EffectComposer.js
/** * @author alteredq / http://alteredqualia.com/ */ THREE.EffectComposer = function ( renderer, renderTarget ) { this.renderer = renderer; if ( renderTarget === undefined ) { var parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, stencilBuffer:...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/postprocessing/ShaderPass.js
10_BrokenMantra/js/libs/postprocessing/ShaderPass.js
/** * @author alteredq / http://alteredqualia.com/ */ THREE.ShaderPass = function ( shader, textureID ) { THREE.Pass.call( this ); this.textureID = ( textureID !== undefined ) ? textureID : "tDiffuse"; if ( shader instanceof THREE.ShaderMaterial ) { this.uniforms = shader.uniforms; this.material = shader...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/10_BrokenMantra/js/libs/postprocessing/MaskPass.js
10_BrokenMantra/js/libs/postprocessing/MaskPass.js
/** * @author alteredq / http://alteredqualia.com/ */ THREE.MaskPass = function ( scene, camera ) { THREE.Pass.call( this ); this.scene = scene; this.camera = camera; this.clear = true; this.needsSwap = false; this.inverse = false; }; THREE.MaskPass.prototype = Object.assign( Object.create( THREE.Pass.pr...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/23_pixel_sorting/pixel-sorting.js
23_pixel_sorting/pixel-sorting.js
const sizeX = 512 const sizeY = 512 let sketch = function(p5) { p5.preload = function() { img = p5.loadImage('https://firebasestorage.googleapis.com/v0/b/doodling-321e8.appspot.com/o/23_pixel_sorting%2Fimg2.jpg?alt=media&token=35b42094-b6cc-4993-af01-a83e7296a022') } p5.setup = function() { p5.createCan...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/23_pixel_sorting/main.js
23_pixel_sorting/main.js
function onLoad() { window.onresize = onResize const canvas = document.getElementById("canvas") const imageCanvas = document.getElementById("imageCanvas") const screenInfo = { pixelRatio: getPixelRatio(canvas.getContext('2d')), width: -1, height: -1 } resizeCanvas() new Pixels(canvas, ima...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/23_pixel_sorting/pixel-sorting-animated.js
23_pixel_sorting/pixel-sorting-animated.js
const sizeX = 512 const sizeY = 512 let sketch = function(p5) { p5.preload = function() { img = p5.loadImage('https://firebasestorage.googleapis.com/v0/b/doodling-321e8.appspot.com/o/23_pixel_sorting%2Fimg2.jpg?alt=media&token=35b42094-b6cc-4993-af01-a83e7296a022') } p5.setup = function() { p5.createCan...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/23_pixel_sorting/p5.min.js
23_pixel_sorting/p5.min.js
/*! p5.js v1.1.9 July 22, 2020 */
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
true
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/23_pixel_sorting/logic.js
23_pixel_sorting/logic.js
function getNearestTo(point, candidates) { const randIdx = getRandomInts(4, 0, candidates.length-1) let minDistance = Number.MAX_VALUE let closestPointIdx = -1 randIdx.forEach(i => { const dist = getDistance(point, candidates[i]) if (dist < minDistance) { closestPointIdx = i minDista...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/23_pixel_sorting/utils.js
23_pixel_sorting/utils.js
function swap(array, i1, i2) { const temp = array[i1] array[i1] = array[i2] array[i2] = temp } function getRandomInts(count, low, high) { const randInts = [] while (randInts.length < count) { randInts.push(getRandomInt(low, high)) } return randInts } function compareColors(c1, c2) { let dr = c1.r ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/SceneManager.js
18_Monolith/js/SceneManager.js
function SceneManager(canvas) { const clock = new THREE.Clock(); const screenDimensions = { width: canvas.width, height: canvas.height } const gameStateManager = new GameStateManager() const scene = buildScene(); const renderer = buildRender(screenDimensions); con...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/main.js
18_Monolith/js/main.js
const canvas = document.getElementById("canvas") const loadingStepBarrier = new StepBarrier(2, begin) const eventBus = new EventBus() const sceneManager = new SceneManager(canvas) const domUIManager = new DomUIManager() cacheResources() bindEventListeners() function onload() { loadingStepBarrier.step() } funct...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/PlayerAndCameraPositionManager.js
18_Monolith/js/PlayerAndCameraPositionManager.js
function PlayerAndCameraPositionManager(camera, player, gameConstants, gameState) { const cameraHeightFromPlayer = { value: .6, offset: 0 } const playerDistanceFromCamera = 1.4 let lastAngleDirection = 0 let lastRadiusDirection = 0 let acceleration = 0 const cameraPolarPostion = { rad...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/utils.js
18_Monolith/js/utils.js
function getRandom(min, max) { return Math.random() * (max - min) + min; } function getRandomInt(min, max) { return Math.round(Math.random() * (max - min) + min); } function clamp01(value) { return Math.min(Math.max(value, 0), 1); } function toRad(deg) { return deg * (Math.PI / 180); } function toDeg(...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/DomUIManager.js
18_Monolith/js/DomUIManager.js
function DomUIManager() { const htmlContainer = document.getElementById("htmlContainer") const disablingDiv = document.getElementById("disablingDiv") const gameOverContainer = document.getElementById("gameOverContainer") const instructionsContainer = document.getElementById("instructionsContainer")...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/gameState/GameStateManager.js
18_Monolith/js/gameState/GameStateManager.js
function GameStateManager() { const maxLives = 4 this.gameConstants = { monolithRadius: 25, minRadius: 50, maxRadius: 200, baseLevelHeight: 15, secondLevelHeight: 25, turretsHeight: 20, speedStep: 0, } this.gameState = { playerPosition...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/sceneSubjects/Floor.js
18_Monolith/js/sceneSubjects/Floor.js
function Floor(scene, gameConstants) { this.group = new THREE.Group() scene.add(this.group) const pillarGeometry = new THREE.BoxBufferGeometry( 1, 1, 1 ) for(let i=0; i<300; i++) placePillarOnMapBorder(this.group, pillarGeometry, gameConstants.maxRadius+20, gameConstants.maxRadius+50) createTerrain(this.gro...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/sceneSubjects/Lights.js
18_Monolith/js/sceneSubjects/Lights.js
function Lights(scene) { const spotLight = new THREE.SpotLight( "#fff", 1, 400, Math.PI/3, 0, 2); spotLight.position.set( 0, 150, 0 ); spotLight.target.position.set(0,0,0); spotLight.castShadow = true scene.add( spotLight ); scene.add( spotLight.target ); const pointLight = new THREE.PointLight( "#fff", .5, 400...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/sceneSubjects/Particles.js
18_Monolith/js/sceneSubjects/Particles.js
function Particles(scene, gameConstants) { const particlesGeometry = new THREE.Geometry(); const range = gameConstants.maxRadius*2; for (let i = 0; i < 100; i++) { const vertex = new THREE.Vector3(); vertex.baseCoords = new THREE.Vector3( getRandom(-range/...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/sceneSubjects/Monolith.js
18_Monolith/js/sceneSubjects/Monolith.js
function Monolith(scene, gameConstants) { const ringsOnMonolith = new THREE.Group() buildMonolith(scene, gameConstants) const bigRingMesh = buildBigRing(scene, gameConstants) buildRingsOnMonolith(scene, gameConstants, ringsOnMonolith) setInterval( moveRings, getRandom(10000, 30000) ) this.update = function(ti...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false