/*
Adapted from http://www.clicktorelease.com/code/css3dclouds/
*Eliminated a lot of it -- Utilized the transform parameters from that tutorial.
*Loading only one image instead of multiples through the JS.
*Auto-Rotation instead of mouse-controlled rotation.
*Doesn't have all those other fancy options
*/
window.requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
})();
var $ = document.getElementById('clds'),
$$ = document.getElementById('sk'),
x = 0,
y = 0,
a = 0;
var larr = [];
var clarr = [];
var mv = 0;
var pov = 400;
var rot = function() {
mv++;
if (mv == pov) {
mv = 0;
} else {
y += 0.1;
}
chngV();
}
var chngV = function() {
var trans = 'translateZ( ' + a + 'px ) rotateX( ' + x + 'deg) rotateY( ' + y + 'deg)';
$.style.webkitTransform = trans;
$.style.MozTransform = trans;
$.style.oTransform = trans;
};
$$.style.webkitPerspective = pov;
$$.style.MozPerspective = pov;
$$.style.oPerspective = pov;
var create = function() {
clarr = [];
if ($.hasChildNodes()) {
while ($.childNodes.length >= 1) {
$.removeChild($.firstChild);
}
}
for (var i = 0; i < 12; i++) {
clarr.push(build());
}
}
var build = function() {
var div = document.createElement('div');
div.className = 'bl';
var x = 256 - (Math.random() * 512);
var y = 256 - (Math.random() * 512);
var z = 256 - (Math.random() * 512);
var trans = 'translateX( ' + x + 'px ) translateY( ' + y + 'px ) translateZ( ' + z + 'px )';
div.style.webkitTransform = trans;
div.style.MozTransform = trans;
div.style.oTransform = trans;
$.appendChild(div);
for (var i = 0; i < 5 + Math.round(Math.random() * 12); i++) {
var c = document.createElement('img');
c.style.opacity...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.