Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <main>
    <div class="combainer-element element0 v8"></div> 
	<div class="combainer-element element1 twlk"></div>
	<div class="combainer-element element2 payforme"></div>
	<div class="combainer-element element3 v8"></div>
	<div class="combainer-element element4 twlk"></div>
	<div class="combainer-element element5 payforme"></div>
	<div class="combainer-element element6 v8"></div>
	<div class="combainer-element element7 twlk"></div>
	<div class="combainer-element element8 payforme"></div>
	<div class="combainer-element element9 v8"></div>
	<div class="combainer-element element10 twlk"></div>
	<div class="combainer-element element11 payforme"></div>
</main>
              
            
!

CSS

              
                body{
	margin:0;
	padding:0;
	width:100%;
	height:100%;
	background-color: #ccc;
	overflow: hidden;
}

.combainer-element {
	position:absolute;
	width:380px;
	height:233px;	
}
.element0{
       top:950px;
       left:-50px;
}
.element1{
       top:850px;
       left:100px;
}
.element2{
       top:750px;
       left:250px;
}
.element3{
       top:650px;
       left:400px;
}
.element4{
       top:550px;
       left:550px;
}
.element5{
       top:450px;
       left:700px;
}
.element6{
       top:350px;
       left:850px;
}
.element7{
       top:250px;
       left:1000px;
}
.element8{
       top:150px;
       left:1150px;
}
.element9{
        top: 50px;
    	left: 1300px;
}
.element10{
       	top: -50px;
    	left: 1450px;
}
.element11{
       	top: -150px;
    	left: 1600px;
}
.twlk{
    background-image: url('http://kozich.ru/skin/tenweek-phone-banner.png');
}
.payforme{
    background-image:url('http://kozich.ru/skin/playforme-phone-banner.png'); 
}
.v8{
    background-image:url('http://kozich.ru/skin/v8-phone-banner.png');
}

              
            
!

JS

              
                function deltaTop(progress) {
   	return progress;
}
function deltaLeft(progress) {
   	return progress*0.88;
}

window.onload = function(){
	var newProduct = document.getElementsByClassName('combainer-element');
	for(var i = 0; i < newProduct.length; i++){
		var start = Date.now();
		animation(newProduct[i],start);
	}

var v8 = 'v8';
	var twlk = 'twlk';
	var payforme = 'payforme';
	var flag = 1;
	setInterval(function() {
		if(flag == 1){
			var start = Date.now();
			animationNew(v8,start);
			flag = 2;
			delElement();
		} else if(flag == 2){
			var start = Date.now();
			animationNew(twlk,start);
			flag = 3;
			delElement();
		}else if(flag == 3){
			var start = Date.now();
			animationNew(payforme,start);
			flag = 1;
			delElement();
		}
	}, 1700);
};

	function animationNew(project, start) {
		//Создаем элемент
		var elem = document.createElement('div');
		elem.setAttribute('class','combainer-element element0 '+project);
		container = document.getElementsByTagName('main')[0];
		container.insertBefore(elem, container.children[0]);

		var topPosition = elem.getBoundingClientRect().top + window.pageYOffset;
		var leftPosition = elem.getBoundingClientRect().left;

		//Анимируем перемещение элемента
		var from = leftPosition; 
		var from2 = topPosition;
		var to = leftPosition + 2200;
		var to2 = topPosition - 1200;
		var duration = 19999;

		requestAnimationFrame(function() {
		    var now = Date.now() - start;
		    var progress = now / duration;
		    var result = (to - from) * deltaLeft(progress) + from;
		    var result2 = (to2 - from2) * deltaTop(progress) + from2;
		    elem.style.left = result + "px";
		    elem.style.top = result2 + "px";
		    if (progress < 1){
		    	requestAnimationFrame(arguments.callee, 1000/60);
		    } else{
		    }
		}, 1000/60);
	};

	function animation(elem, start) {
		var topPosition = elem.getBoundingClientRect().top + window.pageYOffset;
		var leftPosition = elem.getBoundingClientRect().left;

		//Анимируем перемещение элемента
		var from = leftPosition; 
		var from2 = topPosition;
		var to = leftPosition + 2200;
		var to2 = topPosition - 1200;
		var duration = 19999;

		requestAnimationFrame(function() {
		    var now = Date.now() - start;
		    var progress = now / duration;
		    var result = (to - from) * deltaLeft(progress) + from;
		    var result2 = (to2 - from2) * deltaTop(progress) + from2;
		    elem.style.left = result + "px";
		    elem.style.top = result2 + "px";

		    if (progress < 1){
		    	requestAnimationFrame(arguments.callee, 1000/60);
		    } else{
		    }
		}, 1000/60);
	};

function delElement(){
		var elem = document.getElementsByClassName('combainer-element');
		var endElem = elem.length;
		elem[endElem-1].remove();
	}
              
            
!
999px

Console