Pseudo 3d css clouds

Developer
Size
5,199 Kb
Views
18,216

How do I make an pseudo 3d css clouds?

Playing around with clouds. What is a pseudo 3d css clouds? How do you make a pseudo 3d css clouds? This script and codes were developed by David A. on 28 November 2022, Monday.

Pseudo 3d css clouds Previews

Pseudo 3d css clouds - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>pseudo 3d css clouds</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="main" role="main"> <div id="viewport"> <div class="world"></div> </div> <div id="timeline"> <section data-timeline="0"> <h1 class="hidden">1800</h1> </section> <section data-timeline="1"> <h1 class="hidden">1810</h1> </section> <section data-timeline="1.5"> <h1 class="hidden">1815</h1> </section> <section data-timeline="2"> <h1 class="hidden">1820</h1> </section> <section data-timeline="3"> <h1 class="hidden">1830</h1> </section> <section data-timeline="4"> <h1 class="hidden">1840</h1> </section> <section data-timeline="5"> <h1 class="hidden">1850</h1> </section> <section data-timeline="10"> <h1 class="hidden">1900</h1> </section> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Pseudo 3d css clouds - Script Codes CSS Codes

@import url(https://fonts.googleapis.com/css?family=Fira+Sans:300,700);
html, body { height: 100%; overflow: hidden; font-family: 'Fira Sans', sans-serif; font-weight: 300;
}
body { background: #68a8bd; background-image: -webkit-linear-gradient(top, #68a8bd, #fff); background-image: linear-gradient(180deg, #68a8bd, #fff);
}
.hidden { display: none;
}
h1 { position: absolute; top: 0; right: 40px; font-size: 50px; color: #fff; font-weight: 300;
}
#viewport, #viewport .world, .worldLayer { position: absolute;
}
#viewport { top: 0; right: 0; bottom: 0; left: 0; -webkit-perspective: 600; perspective: 600; overflow: hidden;
}
#viewport .world, #viewport .worldLayer { height: 512px; width: 512px; top: 50%; left: 50%; margin: -256px 0 0 -256px; -webkit-transform-style: preserve-3d; transform-style: preserve-3d;
}
#viewport .world { background: rgba(255, 0, 0, 0.5);
}
#viewport .worldLayer:after { content: ""; display: block; position: absolute; top: 20px; bottom: 20px; left: 20px; right: 20px;
}
#viewport .cloud, #viewport .cloudPart { position: absolute; width: 256px; height: 256px; margin: -128px 0 0 -128px; top: 0; left: 0;
}
#viewport .cloud { -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-animation: cloudRotation 400s infinite linear; animation: cloudRotation 400s infinite linear;
}
#viewport .cloud .cloudPart { background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/102565/cloud.png) no-repeat;
}
.worldLayer:nth-child(5n) { background: rgba(255, 0, 0, 0.5);
}
.worldLayer:nth-child(4n) .content { right: 0; left: auto;
}
.worldLayer:nth-child(3n) .content { top: auto; bottom: 0;
}
.content { position: absolute; top: 0; left: 0; padding: 20px; width: 258px; font-size: 20px; color: #000; text-transform: uppercase; font-weight: 700; -webkit-transform: translate3d(0, 0, 25px); transform: translate3d(0, 0, 25px);
}
.content strong { font-size: 80px; font-weight: 300; margin-left: -0.075em;
}
@-webkit-keyframes cloudRotation { from { -webkit-transform: rotate(0deg); transform: rotate(0deg); } to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

Pseudo 3d css clouds - Script Codes JS Codes

var TimeLine, Layer, World, /* Constats */ $doc, nameSpace, /* helpers */ nameSpaced;
$doc = $(document);
nameSpace = "TimeLine";
nameSpaced = function( eventNames,ns ){ var i, events, nameSpaced; events = eventNames.split(" "); for(i = 0; i < events.length; i++){ events[i] = events[i] + "." +(ns || nameSpace); } return events.join(" ");
};
TimeLine = function( $timeLine,groupsSelector,layersSelector,$world,$viewport ){ this.$timeLine = $timeLine; this.groupsSelector = groupsSelector; this.layersSelector = layersSelector; this.$world = $world; this.$viewport = $viewport;
};
/* TimeLine Methods */
TimeLine.prototype.init = function(){ var self = this; self.World = new World( self.$world,self.$viewport ); self._parseTimeline();
};
TimeLine.prototype._parseTimeline = function(){ var self = this;
};
TimeLine.prototype.addLayer = function(){
};
TimeLine.prototype.addGroup = function(){
};
Layer = function( $layer ){
};
World = function( $world,$viewport ){ var self = this; this.$world = $world; this.$viewport = $viewport; this.viewPortWidth = 0; this.viewPortHeight = 0; this.worldXAngle = 0; this.worldYAngle = 0; this.d = 0; //actual depth of the world this.depth = 300; //default death between layers this.initInteraction(); this.clouds = []; this.layers = []; this.stepSpeed = .4; for( var j = 0; j < 100; j++) { var $layer = this.addLayer(j, $("<div class='content'>Cloud Group<br/><strong class='layernr'>Nr. " + j + "</strong></div>")); for ( var i = 0; i < 2; i++) { $layer.append( this.addCloud(2,5) ); } } function animate(){ self.d = self.d - self.stepSpeed; self.updateView(); requestAnimationFrame(animate); } animate();
};
/* World Methods */
World.prototype.initInteraction = function(){ var self = this; self.$viewport.on( nameSpaced("mousemove") , function( e ){ self.worldYAngle = -( 0.5 - ( e.clientX / window.innerWidth ) ) * 2; self.worldXAngle = ( 0.5 - ( e.clientY / window.innerHeight ) ) * 2; //self.updateView(); }); self.$viewport.on( nameSpaced("mousewheel DOMMouseScroll") , function( e ){ e = e ? e : window.event; self.d = self.d - ( e.originalEvent.detail ? e.originalEvent.detail * -5 : e.originalEvent.wheelDelta / 8 ); //self.updateView(); }); self.$viewport.on( nameSpaced("click"), function(){ self.stepSpeed = 0; console.log() } );
};
World.prototype.updateView = function(){ var self = this; //calculate the visible layer //console.log( (-self.d / self.depth) ); self.$world.css('transform', 'translateZ( ' + self.d + 'px ) rotateX( ' + self.worldXAngle + 'deg) rotateY( ' + self.worldYAngle + 'deg)'); /*for(var i = 0; i < self.clouds.length; i++){ self.clouds[i].css('transform', 'rotateX( ' + -1 * self.worldXAngle + 'deg) rotateY( ' + -1 * self.worldYAngle + 'deg)'); }*/
};
World.prototype.addLayer = function( layerdepth,$content ){ var t, $layer, layerHTML = "<div class='worldLayer'></div>"; $layer = $(layerHTML); t = 'translateZ( ' + (layerdepth * this.depth) + 'px )'; $layer.css("transform", t); if( $content ){ $layer.append( $content ); } if(layerdepth > 20){ $layer.css("display", "none"); } this.layers.push( $layer ); this.$world.append( $layer ); return $layer;
};
World.prototype.addCloud = function( minParticles,maxParticles,position ){ var x,y,z,a,s,i,t, layers, $cloud, $cloudPart, cloudHtml = "<div class='cloud'></div>", cloudPartHtml = "<div class='cloudPart'></div>"; $cloud = $(cloudHtml); layers = []; for(i = 0; i < (minParticles || 2) + Math.round( Math.random() * ( maxParticles || 10) ); i++){ $cloudPart = $(cloudPartHtml); x = 256 - ( Math.random() * 256 ); y = 256 - ( Math.random() * 256 ); z = 100 - ( Math.random() * 200 ); a = Math.random() * 360; s = 0.25 + Math.random(); t = 'translateX( ' + x + 'px ) translateY( ' + y + 'px ) translateZ( ' + z + 'px ) rotateZ( ' + a + 'deg ) scale( ' + s + ' )'; $cloudPart.data({ x: x, y: y, z: z, a: a, s: s }).css("transform", t); $cloud.append( $cloudPart ); } $cloud.css({"top": ( Math.random() * 100 ) + "%", "left": ( Math.random() * 100 ) + "%", "transform": "translateZ(" + (Math.random() < 0.5 ? -1 : 1) * Math.random() * 100 + "px)"}); //this.$world.append( $cloud ); return $cloud;
};
/*** init ***/
var TL = new TimeLine( $('#timeline'),"> section","*[data-layer]",$(".world"),$("#viewport") );
TL.init();
Pseudo 3d css clouds - Script Codes
Pseudo 3d css clouds - Script Codes
Home Page Home
Developer David A.
Username meodai
Uploaded November 28, 2022
Rating 3
Size 5,199 Kb
Views 18,216
Do you need developer help for Pseudo 3d css clouds?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

David A. (meodai) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!