3 ms·
How would projection code get you rotational animation for free?
by kristopolous 3y ago
How would projection code get you rotational animation for free?
- DougBTX 3y agoThe projection logic has an orientation parameter (which you'd probably always want, so that you can pick initial rotation), so the rotation animation itself is just updating the param on a timer. Basically line 182 plus the calls to redraw: gamma -= 0.003; To do it with CSS, at a minimum it would require adding support for rendering to two different canvas elements.
- Someone 3y ago> To do it with CSS, at a minimum it would require adding support for rendering to two different canvas elements. It might into trouble because rotating a rectangular <img> area varies it in height and width [1], but I would investigate animating a ‘rotate’ transformation. https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate https://developer.mozilla.org/en-US/docs/Web/CSS/transform-f.... [1] seems to have a demo without that problem, so it seems this can be made to work https://imagekit.io/blog/image-rotation-html-and-css-imagekit/ https://imagekit.io/blog/image-rotation-html-and-css-imageki...
- brianshaler 3y agoHere's an interactive WebGL implementation: https://brian.sh/around/index.html https://brian.sh/around/index.html It doesn't have a satellite image option, but that would arguably be simpler than drawing continents like it does now. It uses a seldom-redrawn base canvas (menu -> debug > show 2d texture) then the discs are drawn with a simple shader.