diff --git a/src/orbital-trails/app.js b/src/orbital-trails/app.js index e69de29..1ed1be9 100644 --- a/src/orbital-trails/app.js +++ b/src/orbital-trails/app.js @@ -0,0 +1,35 @@ +console.log("Initializing animation"); + +const canvas = document.getElementById('mainCanvas'); +const ctx = canvas.getContext('2d'); +const dpr = window.devicePixelRatio; +const cw = window.innerWidth; +const ch = window.innerHeight; +canvas.width = cw * dpr; +canvas.height = ch * dpr; +ctx.scale(dpr, dpr); + +const orbs = []; + +const createOrb = (mx, my) => { + console.log(`Creating orb at ${mx} ${my}`); + const dx = (cw/2) - mx; + const dy = (ch/2) - my; + const dist = Math.sqrt(dx * dx + dy * dy); + const angle = Math.atan2(dy, dx); +}; + + +const initialOrbCount = 100; +for (let n = initialOrbCount; n >= 0; n--) { + createOrb(cw/2, ch/2+(n*2)); +} + +const loop = (timestamp) => { + window.requestAnimationFrame(loop); + //console.log(timestamp); + + +}; + +loop(); diff --git a/src/orbital-trails/index.html b/src/orbital-trails/index.html index 772137f..484e8e7 100644 --- a/src/orbital-trails/index.html +++ b/src/orbital-trails/index.html @@ -7,12 +7,9 @@
-Click and drag to make more!
- - - - View Version 2 +Click to add more