Colored animated cube.
An animated cube. Each side has a different color. diff --git a/index.html b/index.html index 534095d..7dc35c2 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,12 @@
Some WebGL tests
This is my WebGL playground. The examples are taken from the diff --git a/js/parallax.js b/js/parallax.js new file mode 100644 index 0000000..307e56b --- /dev/null +++ b/js/parallax.js @@ -0,0 +1,34 @@ +/* + * OK, this is not really a parallax... I just want to see my content move + * somewhat faster than the background... hey, ho, let's go + */ +var background, content, content_top, content_left; + +function init() { + content = document.getElementById("content"); + content_top = parseFloat(window.getComputedStyle(content).top); + content_left = parseFloat(window.getComputedStyle(content).left); + background = document.getElementById("background"); + background_top = parseFloat(window.getComputedStyle(background).top); + background_left = parseFloat(window.getComputedStyle(background).left); +} + +function parallax() { + if (! document.documentElement) return; + + var v_scroll = + (document.documentElement + && document.documentElement.scrollTop) + || document.body.scrollTop; + + var h_scroll = + (document.documentElement + && document.documentElement.scrollLeft) + || document.body.scrollLeft; + + background.style.top = background_top + Math.round(v_scroll/2); + background.style.left = background_left + Math.round(h_scroll/2); + content.style.top = content_top + Math.round(v_scroll/3.0); + content.style.left = content_left + Math.round(h_scroll/3.0); +} +// vim: set ts=2 sw=2: diff --git a/square.html b/square.html index ac4a555..a897164 100644 --- a/square.html +++ b/square.html @@ -2,6 +2,7 @@
First very simple WebGL example...
This is the beginning, not even 3D. Just initialize the diff --git a/texture.html b/texture.html index 6730931..c60ac3a 100644 --- a/texture.html +++ b/texture.html @@ -2,6 +2,7 @@