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/18_Monolith/js/sceneSubjects/gameEntities/Target.js
18_Monolith/js/sceneSubjects/gameEntities/Target.js
const targetRadius = 2 const targetGeometry = new THREE.SphereBufferGeometry( targetRadius, 16, 16 ); const targetMaterial = new THREE.MeshStandardMaterial({ color: "#F44336", roughness: 0, metalness: .9 }); const targetBlueprint = new THREE.Mesh( targetGeometry, targetMaterial ); const envMap = new THREE.TextureLoa...
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/gameEntities/TurretBulletsShooter.js
18_Monolith/js/sceneSubjects/gameEntities/TurretBulletsShooter.js
function TurretBulletsShooter(scene, position, gameConstants) { const bullets = [] const bulletsCache = [] let currentTime = 0 const shootDelay = .015 let lastShootTime = 0 this.bullets = bullets this.update = function(time) { currentTime = time for(let i=0; i<bullets.leng...
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/gameEntities/Player.js
18_Monolith/js/sceneSubjects/gameEntities/Player.js
function Player(scene, gameState, shooter) { const self = this const group = new THREE.Group() scene.add( group ) const guiManager = new GUIManager(gameState) group.add(guiManager.group) const colors = [ "#F44336", "#3F51B5", "#2196F3", "#009688", "#4CAF50", "#8BC34A", "#CDDC39", "#FFC107", "...
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/gameEntities/GameEntitiesManager.js
18_Monolith/js/sceneSubjects/gameEntities/GameEntitiesManager.js
function GameEntitiesManager(scene, gameConstants, gameState) { const playerShooter = new PlayerBulletsShooter(scene, gameConstants) const player = new Player( scene, gameState, playerShooter ) const monolith = new Monolith(scene, gameConstants) const targetsSpawner = new TargetsSpawner(scene, gameCon...
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/gameEntities/PlayerBulletsShooter.js
18_Monolith/js/sceneSubjects/gameEntities/PlayerBulletsShooter.js
function PlayerBulletsShooter(scene, gameConstants) { const bullets = [] const bulletsCache = [] let currentTime = 0 const shootDelay = .06 let lastShootTime = 0 this.bullets = bullets this.bulletsColor = "#FFF" this.update = function(time) { currentTime = time for(let...
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/gameEntities/Turrets.js
18_Monolith/js/sceneSubjects/gameEntities/Turrets.js
function Turrets(scene, gameConstants, gameState) { const numberOfTargetsPerLevel = 20 const angleStep = (Math.PI*2) / numberOfTargetsPerLevel const turretsLow = [] const targetsHigh = [] let lastShootForwardTime = 0 let shootForwardDelay = 10 const shootForwardDurationConst = 6 let s...
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/gameEntities/TargetsSpawner.js
18_Monolith/js/sceneSubjects/gameEntities/TargetsSpawner.js
function TargetsSpawner(scene, gameConstants) { const targets = [] const targetsCache = [] const spawnerMesh = buildSpawnerMesh(scene) const spawnerMovement = new TargetSpawnerMovement(spawnerMesh, gameConstants) const originalMaxSpawnDelay = 1 let maxSpawnDelay = 1 const minSpawnDelay...
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/gameEntities/movement/TargetSpawnerMovement.js
18_Monolith/js/sceneSubjects/gameEntities/movement/TargetSpawnerMovement.js
function TargetSpawnerMovement(mesh, gameConstants) { mesh.position.y = gameConstants.baseLevelHeight const angleSpeed = .006 const acceletationMax = 1 const accelerationIncreaseStep = 0.02 const accelerationDecreaseStep = 0.009 const angleAccelerator = new Accelerator(angleSpeed, acceleta...
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/gameEntities/unutilezedEntities/LaserShooter.js
18_Monolith/js/sceneSubjects/gameEntities/unutilezedEntities/LaserShooter.js
function LaserShooter(scene, gameConstants) { const laserBlueprint = new THREE.Group() const geometrySphere = new THREE.SphereBufferGeometry( 2, 16, 16 ) const materialSphere = new THREE.MeshBasicMaterial( {color: "#000"} ) const laserSphereMesh = new THREE.Mesh( geometrySphere, materialSphere ) l...
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/gameEntities/unutilezedEntities/BoostSpawner.js
18_Monolith/js/sceneSubjects/gameEntities/unutilezedEntities/BoostSpawner.js
function BoostSpawner(scene, gameConstants) { const OBJECT_NAME = "boost_mesh" const minDelay = 1 const maxDelay = 2 const meshBoundingBox = 8 const geometry = new THREE.BoxBufferGeometry( meshBoundingBox, meshBoundingBox, meshBoundingBox ); const material = new THREE.MeshBasicMaterial( {colo...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/controls/MouseControls.js
18_Monolith/js/controls/MouseControls.js
function MouseControls( gameState, playerAndCameraPositionManager, player ) { let shoot = false eventBus.subscribe(gameOverEvent, onLeftClickUp ) this.onMouseDown = function(event) { switch (event.which) { case 1: onLeftClickDown() break; ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/controls/Accelerator.js
18_Monolith/js/controls/Accelerator.js
function Accelerator(speed, accelerationMax, accelerationIncreaseStep, accelerationDecreaseStep) { let acceleration = 0 let prevDirection = 0 this.getForce = function(direction) { updateAngleAcceleration(direction) prevDirection = direction return speed * acceleration } ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/controls/PolarControls.js
18_Monolith/js/controls/PolarControls.js
function PolarControls(playerAndCameraPositionManager, gameConstants, gameState) { const W = 87 const A = 65 const S = 83 const D = 68 const angleSpeed = .02 const radSpeed = 1 const acceletationMax = 1 const accelerationIncreaseStep = 0.02 const accelerationDecreaseStep = 0.009 ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/terrain/SimplexNoise.js
18_Monolith/js/terrain/SimplexNoise.js
// Ported from Stefan Gustavson's java implementation // http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf // Read Stefan's excellent paper for details on how this code works. // // Sean McCullough banksean@gmail.com // // Added 4D noise // Joshua Koo zz85nus@gmail.com /** * You can pass in a random nu...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/terrain/Noise.js
18_Monolith/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/18_Monolith/js/terrain/MapGenerator.js
18_Monolith/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 = 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/terrain/PRNG.js
18_Monolith/js/terrain/PRNG.js
/** * Creates a pseudo-random value generator. The seed must be an integer. * * Uses an optimized version of the Park-Miller PRNG. * http://www.firstpr.com.au/dsp/rand31/ */ function Random(seed) { this._seed = seed % 2147483647; if (this._seed <= 0) this._seed += 2147483646; } /** * Returns a pseudo-random ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/terrain/TerrainMeshGenerator.js
18_Monolith/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].leng...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/terrain/FalloffGenerator.js
18_Monolith/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/18_Monolith/js/ui/GUIManager.js
18_Monolith/js/ui/GUIManager.js
function GUIManager(gameState) { const group = new THREE.Group() this.group = group const comboLength = 5 let comboStreak = 0 let scoreMultiplier = 1 let comboMesh const scoreTextureObj = new CanvasTexture("score: ") scoreTextureObj.setText(gameState.score) const comboTextur...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/ui/CanvasTexture.js
18_Monolith/js/ui/CanvasTexture.js
function CanvasTexture(constantText = "") { var canvas = document.createElement('canvas'); const baseDim = 128; const widthRatio = 1; const heightRatio = 4; canvas.width = baseDim/widthRatio; canvas.height = baseDim/heightRatio; const ctx = canvas.getContext('2d') this.widthRatio = wi...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/libs/tinycolor.js
18_Monolith/js/libs/tinycolor.js
// TinyColor v1.4.1 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License (function(Math) { var trimLeft = /^\s+/, trimRight = /\s+$/, tinyCounter = 0, mathRound = Math.round, mathMin = Math.min, mathMax = Math.max, mathRandom = Math.random; function tinycolor (color, opts) {...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
true
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/libs/postprocessing/GlitchPass.js
18_Monolith/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/18_Monolith/js/libs/postprocessing/FilmShader.js
18_Monolith/js/libs/postprocessing/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/18_Monolith/js/libs/postprocessing/VignetteShader.js
18_Monolith/js/libs/postprocessing/VignetteShader.js
/** * @author alteredq / http://alteredqualia.com/ * * Vignette shader * based on PaintEffect postprocess from ro.me * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js */ THREE.VignetteShader = { uniforms: { "tDiffuse": { value: null }, "offset": { value: 1.0 }, ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/libs/postprocessing/FilmPass.js
18_Monolith/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/18_Monolith/js/libs/postprocessing/RGBShiftShader.js
18_Monolith/js/libs/postprocessing/RGBShiftShader.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/18_Monolith/js/libs/postprocessing/DigitalGlitch.js
18_Monolith/js/libs/postprocessing/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/18_Monolith/js/libs/postprocessing/CopyShader.js
18_Monolith/js/libs/postprocessing/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/18_Monolith/js/libs/postprocessing/RenderPass.js
18_Monolith/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/18_Monolith/js/libs/postprocessing/EffectComposer.js
18_Monolith/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/18_Monolith/js/libs/postprocessing/StaticShader.js
18_Monolith/js/libs/postprocessing/StaticShader.js
/** * @author Felix Turner / www.airtight.cc / @felixturner * * Static effect. Additively blended digital noise. * * amount - amount of noise to add (0 - 1) * size - size of noise grains (pixels) * * The MIT License * * Copyright (c) 2014 Felix Turner * * Permission is hereby granted, free of charge, to a...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/libs/postprocessing/ShaderPass.js
18_Monolith/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/18_Monolith/js/eventBus/EventBus.js
18_Monolith/js/eventBus/EventBus.js
function EventBus() { const eventCallbacksPairs = []; this.subscribe = function( eventType, callback ) { const eventCallbacksPair = findEventCallbacksPair(eventType); if(eventCallbacksPair) eventCallbacksPair.callbacks.push(callback); else eventCallbacksPair...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/18_Monolith/js/eventBus/constants.js
18_Monolith/js/eventBus/constants.js
const startBoost = "startBoost" const increaseScore = "increaseScore" const decreaseScore = "decreaseScore" const decreaseLife = "decreaseLife" const gameOverEvent = "gameOverEvent" const introScreenClosed = "introScreenClosed" const startCountDownFinishedEvent = "startCountDownFinishedEvent"
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/common/libs/SimplexNoise.js
common/libs/SimplexNoise.js
// Ported from Stefan Gustavson's java implementation // http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf // Read Stefan's excellent paper for details on how this code works. // // Sean McCullough banksean@gmail.com // // Added 4D noise // Joshua Koo zz85nus@gmail.com /** * You can pass in a random nu...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/common/libs/OrbitControls.js
common/libs/OrbitControls.js
/** * @author qiao / https://github.com/qiao * @author mrdoob / http://mrdoob.com * @author alteredq / http://alteredqualia.com/ * @author WestLangley / http://github.com/WestLangley * @author erich666 / http://erichaines.com */ // This set of controls performs orbiting, dollying (zooming), and panning. // Unlik...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/common/libs/OBJLoader.js
common/libs/OBJLoader.js
/** * @author mrdoob / http://mrdoob.com/ */ THREE.OBJLoader = ( function () { // o object_name | g group_name var object_pattern = /^[og]\s*(.+)?/; // mtllib file_reference var material_library_pattern = /^mtllib /; // usemtl material_name var material_use_pattern = /^usemtl /; function ParserState() { ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/common/libs/PRNG.js
common/libs/PRNG.js
/** * Creates a pseudo-random value generator. The seed must be an integer. * * Uses an optimized version of the Park-Miller PRNG. * http://www.firstpr.com.au/dsp/rand31/ */ function Random(seed) { this._seed = seed % 2147483647; if (this._seed <= 0) this._seed += 2147483646; } /** * Returns a pseudo-random ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/common/libs/Tween.js
common/libs/Tween.js
/** * Tween.js - Licensed under the MIT license * https://github.com/tweenjs/tween.js * ---------------------------------------------- * * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors. * Thank you all, you're awesome! */ var TWEEN = TWEEN || (function () { var ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/common/libs/three_v87.min.js
common/libs/three_v87.min.js
// threejs.org/license (function(m,na){"object"===typeof exports&&"undefined"!==typeof module?na(exports):"function"===typeof define&&define.amd?define(["exports"],na):na(m.THREE=m.THREE||{})})(this,function(m){function na(){}function D(a,b){this.x=a||0;this.y=b||0}function N(a,b,c,d,e,f,g,h,k,l){Object.defineProperty(...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
true
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/14_ThreejsTemplate/js/SceneManager.js
14_ThreejsTemplate/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/14_ThreejsTemplate/js/main.js
14_ThreejsTemplate/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/14_ThreejsTemplate/js/sceneSubjects/SceneSubject.js
14_ThreejsTemplate/js/sceneSubjects/SceneSubject.js
function SceneSubject(scene) { const radius = 2; const mesh = new THREE.Mesh(new THREE.IcosahedronBufferGeometry(radius, 2), new THREE.MeshStandardMaterial({ flatShading: true })); mesh.position.set(0, 0, -20); scene.add(mesh); this.update = function(time) { const scale = Math.sin(time)+2; mesh.scale.se...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/14_ThreejsTemplate/js/sceneSubjects/GeneralLights.js
14_ThreejsTemplate/js/sceneSubjects/GeneralLights.js
function GeneralLights(scene) { const light = new THREE.PointLight("#2222ff", 1); 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/14_ThreejsTemplate/js/libs/three.min.js
14_ThreejsTemplate/js/libs/three.min.js
// threejs.org/license (function(m,na){"object"===typeof exports&&"undefined"!==typeof module?na(exports):"function"===typeof define&&define.amd?define(["exports"],na):na(m.THREE=m.THREE||{})})(this,function(m){function na(){}function D(a,b){this.x=a||0;this.y=b||0}function N(a,b,c,d,e,f,g,h,k,l){Object.defineProperty(...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
true
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/21_flow_strokes/perlin.js
21_flow_strokes/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/21_flow_strokes/main.js
21_flow_strokes/main.js
function onLoad() { window.onresize = onResize const canvas = document.getElementById("canvas") const screenInfo = { pixelRatio: getPixelRatio(canvas.getContext('2d')), width: -1, height: -1 } resizeCanvas() let flow = new Flow(canvas, screenInfo) let time = 0 render() document.add...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/21_flow_strokes/flow.js
21_flow_strokes/flow.js
function Flow(canvas, screenInfo) { const context = canvas.getContext("2d") noise.seed(Math.random()) const palette = getRandomPalette() const borderXFactor = 4 const borderYFactor = 4 const circlesOffset = 100 const particlesSize = 1800 let particles = getParticles() let circles = getCircles() ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/21_flow_strokes/utils.js
21_flow_strokes/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/11_Shaders/js/SceneManager.js
11_Shaders/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/11_Shaders/js/main.js
11_Shaders/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/11_Shaders/js/Background.js
11_Shaders/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/11_Shaders/js/Utils.js
11_Shaders/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/11_Shaders/js/Sphere.js
11_Shaders/js/Sphere.js
function Sphere(scene) { var uniforms = { time: { type: 'f', value: 0 }, mousePosition: { type: "v3", value: new THREE.Vector2( 0, 0, 0 ) }, }; var material = new THREE.ShaderMaterial( { uniforms, vertexShad...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/02_Snail/js/main.js
02_Snail/js/main.js
var scene, camera, controls, fieldOfView, aspectRatio, nearPlane, farPlane, shadowLight, backLight, light, renderer, container; var HEIGHT, WIDTH, windowHalfX, windowHalfY, mousePos = {x:0,y:0}; var rightIris, leftIris; var eyeLineRight, eyeLineLeft; function i...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/08_NeonsNStuff/js/SceneManager.js
08_NeonsNStuff/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 }; var width = canvas.width; var height = canvas.height; var scene = new THREE.Scene(); scene.backgr...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/08_NeonsNStuff/js/Spheres.js
08_NeonsNStuff/js/Spheres.js
function Spheres(scene, cubeCamera) { // deformed sphere var icoGeometry = new THREE.IcosahedronGeometry(1, 6); var icoMaterial = new THREE.MeshStandardMaterial({ color: "#222222", roughness: 0, metalness: .9, flatShading: false, transparent: true, opacity: 1, side: THREE.DoubleSide, alphaTest: 0.5...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/08_NeonsNStuff/js/main.js
08_NeonsNStuff/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/08_NeonsNStuff/js/Background.js
08_NeonsNStuff/js/Background.js
function Background(scene, cubeCamera) { var backgroundGeometry = new THREE.IcosahedronGeometry(20, 0); var backgroundMaterial = new THREE.MeshStandardMaterial({ color: "#000004", roughness: 1, metalness: .5, flatShading: true, side: THREE.BackSide }); var background = new THREE.Mesh(backgroundGeometry, bac...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/08_NeonsNStuff/js/Utils.js
08_NeonsNStuff/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/08_NeonsNStuff/js/Rings.js
08_NeonsNStuff/js/Rings.js
function Rings(scene, cubeCamera) { var group = new THREE.Group(); var radius = 2; var geometry = new THREE.TorusGeometry(radius, .055, 32, 128); var material = new THREE.MeshStandardMaterial({ color: "#222222", roughness: 0, metalness: .9, flatShading: false }); var envMap = new THREE.TextureLoa...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/08_NeonsNStuff/js/DoublePyramid.js
08_NeonsNStuff/js/DoublePyramid.js
function DoublePyramid(scene, cubeCamera) { var group = new THREE.Group(); var size = .4; var pyramidGeometry = new THREE.CylinderGeometry( 0, size, size, 4, 1 ); var material = new THREE.MeshStandardMaterial({ color: "#B71C1C", roughness: 0, flatShading: true }); var top = new THREE.Mesh(pyramid...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/15_MarkovMusic/js/NotesGenerator.js
15_MarkovMusic/js/NotesGenerator.js
function NotesGenerator() { const context = new AudioContext(); this.playNote = function(freq) { const oscillator = context.createOscillator(); const waveForm = getWaveForm(getRandomInt(1, 1)); oscillator.type = waveForm; const fac = 2; oscillator.frequenc...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/15_MarkovMusic/js/Notes.js
15_MarkovMusic/js/Notes.js
const notes = { // "A2": 131, // "A#2": 139, // "B♭2": 147, // "B2": 156, // "C3": 165, // "C#3": 175, // "D♭3": 185, "D3": 196, // "D#3": 208, "E♭3": 220, // "E3": 233, "F3": 247, "F#3": 262, // "G♭3": 277, "G3": 294, // "G#3": 311, "A♭3": 3...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/15_MarkovMusic/js/index.js
15_MarkovMusic/js/index.js
const table = document.getElementById("table"); let time = 0; let rand = 0; const nodes = []; for(key in notes) nodes.push({ name: key, freq: notes[key]}); const graph = new MarkowGraph(nodes.length); const graphBackground = new MarkowGraph(nodes.length); const notesGenerator = new NotesGenerator(); let prevElm...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/15_MarkovMusic/js/MarkovGraph.js
15_MarkovMusic/js/MarkovGraph.js
function MarkowGraph(numberOfNodes) { if(numberOfNodes <= 0) console.error("number of nodes not valid"); const graph = [numberOfNodes]; let currentRowIndx = 0; for(let i=0; i<numberOfNodes; i++) graph[i] = [numberOfNodes]; setProbabilities(); this.getGraph = function() { ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/06_NeonCrystal/js/SceneManager.js
06_NeonCrystal/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 }; var width = canvas.width; var height = canvas.height; var scene = new THREE.Scene(); scene.backgr...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/06_NeonCrystal/js/main.js
06_NeonCrystal/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/06_NeonCrystal/js/Utils.js
06_NeonCrystal/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/06_NeonCrystal/js/CrystalSceneSubject.js
06_NeonCrystal/js/CrystalSceneSubject.js
function CrystalSceneSubject(scene, cubeCamera) { var startVertices = new Array(); // crystal var icoGeometry = new THREE.IcosahedronGeometry(1.5, 3); var icoMaterial = new THREE.MeshPhongMaterial({ color: "#000", shininess: 1, flatShading: true, envMap: cubeCamera.renderTarget.texture, reflectivity: 0.1...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/19_stuff/js/SceneManager.js
19_stuff/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/19_stuff/js/main.js
19_stuff/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/19_stuff/js/sceneSubjects/Fog.js
19_stuff/js/sceneSubjects/Fog.js
function Fog(scene) { const textureLoader = new THREE.TextureLoader(); const mainTexture = textureLoader.load("textures/fog1.jpg"); mainTexture.wrapS = THREE.RepeatWrapping; mainTexture.wrapT = THREE.RepeatWrapping; const secTexture = textureLoader.load("textures/fog.jpg"); secTexture.wrapS =...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/19_stuff/js/sceneSubjects/Floor.js
19_stuff/js/sceneSubjects/Floor.js
function Floor(scene) { const left = new THREE.Mesh( new THREE.BoxGeometry(20, 20, 10), new THREE.MeshStandardMaterial({ color: "#000", metalness: 1, roughness: 0.5 }) ) left.position.set(-10.4, -10.8, -6); scene.add(left); const right = left.clone() right.position.set(10.4, -10.8, -6) ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/19_stuff/js/sceneSubjects/SceneSubject.js
19_stuff/js/sceneSubjects/SceneSubject.js
function SceneSubject(scene) { const radius = 2; const sphere = new THREE.Mesh( new THREE.IcosahedronBufferGeometry(radius, 2), new THREE.MeshStandardMaterial({ flatShading: true }) ); sphere.position.set(0, 0, -20); // scene.add(sphere); const box = new THREE.Mesh( new THREE.BoxGeometry(0.2, 0.8, 0.6)...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/19_stuff/js/sceneSubjects/GeneralLights.js
19_stuff/js/sceneSubjects/GeneralLights.js
function GeneralLights(scene) { const light = new THREE.PointLight("#DA9B9B", 0.5); light.position.set(0, 4, -4) scene.add(light); this.update = function(time) { light.intensity = 0.5 + (Math.sin(time) +1) / 5 // light.position.z = -4 + ( (Math.sin(time)+1) / 2 ) *-10 // light.intensity = (Math.sin(tim...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/19_stuff/js/libs/postprocessing/GlitchPass.js
19_stuff/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/19_stuff/js/libs/postprocessing/FilmShader.js
19_stuff/js/libs/postprocessing/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/19_stuff/js/libs/postprocessing/VignetteShader.js
19_stuff/js/libs/postprocessing/VignetteShader.js
/** * @author alteredq / http://alteredqualia.com/ * * Vignette shader * based on PaintEffect postprocess from ro.me * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js */ THREE.VignetteShader = { uniforms: { "tDiffuse": { value: null }, "offset": { value: 1.0 }, ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/19_stuff/js/libs/postprocessing/FilmPass.js
19_stuff/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/19_stuff/js/libs/postprocessing/RGBShiftShader.js
19_stuff/js/libs/postprocessing/RGBShiftShader.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/19_stuff/js/libs/postprocessing/DigitalGlitch.js
19_stuff/js/libs/postprocessing/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/19_stuff/js/libs/postprocessing/CopyShader.js
19_stuff/js/libs/postprocessing/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/19_stuff/js/libs/postprocessing/RenderPass.js
19_stuff/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/19_stuff/js/libs/postprocessing/EffectComposer.js
19_stuff/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/19_stuff/js/libs/postprocessing/StaticShader.js
19_stuff/js/libs/postprocessing/StaticShader.js
/** * @author Felix Turner / www.airtight.cc / @felixturner * * Static effect. Additively blended digital noise. * * amount - amount of noise to add (0 - 1) * size - size of noise grains (pixels) * * The MIT License * * Copyright (c) 2014 Felix Turner * * Permission is hereby granted, free of charge, to a...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/19_stuff/js/libs/postprocessing/ShaderPass.js
19_stuff/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/12_CollatzConjecture/js/Stack.js
12_CollatzConjecture/js/Stack.js
function Stack(value) { let top; if(value) top = new Node(value); else top = null; this.pop = function() { if(!top) return null; const result = top; top = top.next; return result.value; } this.push = function(value) { const newNode = new Node(value); newNode.next = top; top = newNode; }...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/TreeNode.js
12_CollatzConjecture/js/TreeNode.js
function TreeNode(value) { this.value = value; this.children = new Array(); this.isLeaf = function() { return this.children.length === 0; } }
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/SceneManager.js
12_CollatzConjecture/js/SceneManager.js
function SceneManager(canvas, tree) { const state = { pixelRatio: -1, width: -1, height: -1 } const stage = new createjs.Stage(canvas); state.pixelRatio = getPixelRatio(canvas.getContext('2d')); const vizS = [ new CollatzViz0(stage, state, tree), new Collatz...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/Queue.js
12_CollatzConjecture/js/Queue.js
function Queue(value) { let top; if(value) top = new Node(value); else top = null; let last = top; this.dequeue = function() { if(!top) return null; const result = top; top = top.next; return result.value; } this.enqueue = function(value) { const newNode = new Node(value); if(top === nul...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/main.js
12_CollatzConjecture/js/main.js
function onLoad() { const canvas = document.getElementById("canvas"); window.onresize = resizeCanvas; var values = new Array(); for(var i=0; i<100; i++) { values.push( Math.floor(getRandom(1, 1000)) ); } var tree = new CollatzTreeBuilder().build(values); const sceneManager = new ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/CollatzTreeBuilder.js
12_CollatzConjecture/js/CollatzTreeBuilder.js
function CollatzTreeBuilder() { this.build = function(values) { const tree = new TreeNode(8); for(let i=0; i<values.length; i++) { const queue = new Queue(); collatz(values[i], number => queue.enqueue(number)); merge(tree, queue); } return tree; } function merge(tree, qu...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/Utils.js
12_CollatzConjecture/js/Utils.js
/** * [getPixelRatio Given a canvas 2D context returns a pixel ratio] * @param {[canvas context]} context [convas 2D context] * @return {[number]} [pixelRatio] */ function getPixelRatio(context) { const devicePixelRatio = window.devicePixelRatio || 1; const backingStoreRatio = context.webkitBacking...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/visualizations/CollatzViz0.js
12_CollatzConjecture/js/visualizations/CollatzViz0.js
function CollatzViz0(stage, state, tree) { const shape = new createjs.Shape(); const graphics = shape.graphics; stage.addChild(shape); this.draw = function() { const stack = new Stack(); let rad = 0, angle = 0; const color = new Color(); const xOffset = state.width/2; ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/visualizations/CollatzViz1.js
12_CollatzConjecture/js/visualizations/CollatzViz1.js
function CollatzViz1(stage, state, tree) { const shape = new createjs.Shape(); const graphics = shape.graphics; stage.addChild(shape); this.draw = function() { const stack = new Stack(); let rad = 0, angle = 0; const color = new Color(); const xOffset = state.width/2; ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/visualizations/CollatzViz2.js
12_CollatzConjecture/js/visualizations/CollatzViz2.js
function CollatzViz2(stage, state, tree) { const shape = new createjs.Shape(); const graphics = shape.graphics; stage.addChild(shape); this.draw = function() { const stack = new Stack(); let rad = 0, angle = 0; const color = new Color(); const xOffset = state.width/2;...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/visualizations/CollatzViz3.js
12_CollatzConjecture/js/visualizations/CollatzViz3.js
function CollatzViz3(stage, state, tree) { const shape = new createjs.Shape(); const graphics = shape.graphics; stage.addChild(shape); this.draw = function() { const stack = new Stack(); let rad = 0, angle = 0; const color = new Color(); const xOffset = state.width/2;...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false
PierfrancescoSoffritti/doodles
https://github.com/PierfrancescoSoffritti/doodles/blob/9090a3a441b322593c2468caafb4aa3f3eba7706/12_CollatzConjecture/js/visualizations/CollatzViz4.js
12_CollatzConjecture/js/visualizations/CollatzViz4.js
function CollatzViz4(stage, state, tree) { const shape = new createjs.Shape(); const graphics = shape.graphics; stage.addChild(shape); this.draw = function() { const stack = new Stack(); let rad = 0, angle = 0; const color = new Color(); const xOffset = state.width/2; ...
javascript
Apache-2.0
9090a3a441b322593c2468caafb4aa3f3eba7706
2026-01-05T03:43:45.246895Z
false