HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs 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 its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
.scene{'data-deep-ui' => 'true'}
.cover
.scene_inner
.arrow
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/right-arrow.png'}
.logo
MOVIZ
.scene_inner__left
.overlay
.coverOne.coverA
.coverTwo.coverA
.coverThree.coverA
.coverFour.coverA
.wrap
.left.textOne{:xmlns => 'http://www.w3.org/1999/xhtml'}
.left_title
Avengers: Endgame
.left_description
Twenty-three days after Thanos used the Infinity Gauntlet to disintegrate half of all life in the universe, Carol Danvers rescues Tony Stark and Nebula from deep space and returns them to Earth.
.left_cta
Read more
.left.textTwo{:xmlns => 'http://www.w3.org/1999/xhtml'}
.left_title
Ready Player One
.left_description
When the creator of a virtual reality called the OASIS dies, he makes a posthumous challenge to all OASIS users to find his Easter Egg, which will give the finder his fortune and control of his world.
.left_cta
Read more
.left.textThree{:xmlns => 'http://www.w3.org/1999/xhtml'}
.left_title
Annabelle Comes Home
.left_description
While babysitting the daughter of Ed and Lorraine Warren, a teenager and her friend unknowingly awaken an evil spirit trapped in a doll
.left_cta
Read more
.left.textFour{:xmlns => 'http://www.w3.org/1999/xhtml'}
.left_title
X-Men: Dark Phoenix
.left_description
Jean Grey begins to develop incredible powers that corrupt and turn her into a Dark Phoenix. Now the X-Men will have to decide if the life of a team member is worth more than all of humanity.
.left_cta
Read more
.left.textFive{:xmlns => 'http://www.w3.org/1999/xhtml'}
.left_title
Avengers: Age of ultron
.left_description
Twenty-three days after Thanos used the Infinity Gauntlet to disintegrate half of all life in the universe, Carol Danvers rescues Tony Stark and Nebula from deep space and returns them to Earth.
.left_cta
Read more
.scene_inner__right
%h4 Featured movies
.menu
.scene_inner__slider
.slide.slide_one{:xmlns => 'http://www.w3.org/1999/xhtml'}
%h2.slide_title Avengers: Endgame
%p.slide_text An absolute epic movie out in 2019
.slide.slide_two{:xmlns => 'http://www.w3.org/1999/xhtml'}
%h2.slide_title Ready Player One
%p.slide_text An absolute epic movie out in 2019
.slide.slide_three{:xmlns => 'http://www.w3.org/1999/xhtml'}
%h2.slide_title Annabelle Comes Home
%p.slide_text An absolute epic movie out in 2019
.slide.slide_four{:xmlns => 'http://www.w3.org/1999/xhtml'}
%h2.slide_title X-Men: Dark Phoenix
%p.slide_text An absolute epic movie out in 2019
.slide.slide_five{:xmlns => 'http://www.w3.org/1999/xhtml'}
%h2.slide_title Avengers: Age of ultron
%p.slide_text An absolute epic movie out in 2019
@import url('https://fonts.googleapis.com/css?family=Lato&display=swap');
canvas {
position: absolute;
background: transparent;
transition: all 1.2s .3s cubic-bezier(.6, 0.005, 0.525, 0.990);
left: 0;
pointer-events: none;
}
.arrow {
position: absolute;
z-index: 1;
top: 230px;
left: 390px;
z-index: 100;
cursor: pointer;
cursor: pointer;
border: 2px solid rgba(255, 255, 255, 0.2);
height: 40px;
width: 40px;
border-radius:40px;
transition: all .6s;
&:hover {
border: 2px solid rgba(255, 255, 255, 1);
}
animation: pulse 1s infinite;
@keyframes pulse {
from{box-shadow: 0 0 0 0px rgba(255, 255, 255, 1)}
to{box-shadow: 0 0 0 20px rgba(255, 255, 255, 0)}
}
img{
width: 20px;
position: relative;
top: 10px;
left: 10px;
}
}
.coverA{
position: absolute;
height: 100%;
width: 100%;
transition: all 1.2s .2s cubic-bezier(.6, 0.005, 0.525, 0.990);
//background: url('https://cdn1.thr.com/sites/default/files/imagecache/scale_crop_768_433/2018/03/ready_player_one_still_19.jpg');
background-size: cover !important;
background-position: center;
clip-path: polygon(100% 0, 100% 0, 100% 98%, 100% 100%);
}
.coverOne {
background: url('https://static.gbtimes.com/uploads/files/2018-05/11/Marvel_Avengers_Infinity_War_China_cropped.jpg');
clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%)
}
.coverTwo {
background: url('https://m.media-amazon.com/images/M/MV5BY2JiYTNmZTctYTQ1OC00YjU4LWEwMjYtZjkwY2Y5MDI0OTU3XkEyXkFqcGdeQXVyNTI4MzE4MDU@._V1_.jpg');
}
.coverThree {
background: url('https://www.valmorgan.com.au/wp-content/uploads/2019/05/Annabelle-Comes-Home.jpg');
}
.coverFour {
background: url('https://media.vanityfair.com/photos/5cf6bc683fe2aa92ef75a3d6/2:3/w_557,h_836,c_limit/Dark-Phoenix-Review.jpg');
}
.coverFive {
background: url('https://static.gbtimes.com/uploads/files/2018-05/11/Marvel_Avengers_Infinity_War_China_cropped.jpg');
}
.logo {
color: white;
position: absolute;
font-family: lato;
z-index: 10;
font-size: 12px;
top: 20px;
left: 25px;
opacity: 0.6;
}
.cover {
position: fixed;
height: 400px;
background: linear-gradient(-90deg, #0d040e 52%, transparent);
width: 20%;
z-index: 11;
right: 0;
top: 50%;
transform: translateY(-50%) translateZ(100px);
}
body {
overflow: hidden;
margin: 0;
background: #0d040e;
}
canvas {
transform: translateZ(10px);
}
canvas#textOne, canvas#textOne--pre {
transform: translateY(-70px) translateZ(13px);
position: absolute;
}
canvas#textTwo, canvas#textTwo--pre {
transform: translateY(-227px) translateZ(13px);
position: absolute;
opacity: 0;
}
canvas#textThree, canvas#textThree--pre {
transform: translateY(-384px) translateZ(13px);
position: absolute;
opacity: 0;
}
canvas#textFour, canvas#textFour--pre {
transform: translateY(-541px) translateZ(13px);
position: absolute;
opacity: 0;
}
canvas#textFive, canvas#textFive--pre {
transform: translateY(-698px) translateZ(13px);
position: absolute;
opacity: 0;
}
canvas#slide_one, canvas#slide_one--pre,
canvas#slide_two, canvas#slide_two--pre,
canvas#slide_three, canvas#slide_three--pre,
canvas#slide_four, canvas#slide_four--pre,
canvas#slide_five, canvas#slide_five--pre{
transform: translateZ(30px);
}
.scene {
height: 100vh;
opacity: 0;
transition: opacity 1s;
&_inner {
width: 900px;
box-shadow: 0 0 60px rgba(210, 49, 230, 0.0784313725490196);
height: 500px;
border-radius: 8px;
position: absolute;
-webkit-box-reflect: below 10px linear-gradient(to top, rgba(255, 255, 255, 1) -120%, rgba(255,255,255,0) 25%);
left: 0;
right: 0;
margin: auto;
top: 50%;
transform: translateY(-50%);
&__left {
width: 60%;
height: 100%;
float: left;
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
font-family: 'lato';
position: relative;
background-size: cover;
background-position: center;
overflow: hidden;
transform-style: preserve-3d;
.overlay {
opacity: .8;
position: fixed;
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
width: 60%;
height: 100%;
background: #0a0415;
z-index: 1;
}
.wrap {
position: absolute;
top: 50%;transform-style: preserve-3d;
}
& .left {
width: 30%;
left: 60px;
width : 400px;
&_title {
font-size: 20px;
margin-bottom: 10px;
}
&_description {
font-size: 14px;
opacity: 0.8;
}
&_cta {
padding: 10px 20px 12px 20px;
border-radius: 4px;
font-size: 14px;
color: white;
background: black;
display: inline-block;
margin-top: 20px;
}
}
}
&__right {
width: 40%;
background: #fff;
height: 100%;
transform-style: preserve-3d;
float: left;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
h4 {
font-family: 'lato';
position: absolute;
font-size: 20px;
transform: translateZ(20px) translateY(80px) translateX(25px);
}
& .menu {
width: 18px;
height: 2px;
background: #111114;
position: absolute;
right: 20px;
top: 20px;
&:after {
content: '';
display: block;
position: relative;
top: 2px;
width: 18px;
height: 2px;
background: #111114;
}
&:before {
content: '';
display: block;
position: relative;
top: 9px;
width: 10px;
height: 2px;
background: #111114;
}
}
}
&__slider {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: -560px;
width: 1000px;
& .slide {
background: #f5e0bf;
width: 150px;
height: 180px;
border-radius: 8px;
color: white;
font-family: 'Lato';
display: inline-block;
margin-right: 10px;
&_title {
font-size: 14px;
padding: 70px 20px 0 20px;
}
&_text {
font-size: 12px;
line-height: 18px;
padding: 0 20px 0 20px;
opacity: 0.8;
}
}
}
}
}
setTimeout(function(){
$('.scene').css('opacity', 1)
}, 1000);
// ## Deep-ui | 3D User interface builder
// ## Depths can be defined on the html element as data-depth.
// ## Depth is calculated from the parent element with depth-ui set as true.
// ## Set data-deep-animate & data-deep-animate-time to true on parent to animate to point.
function deep_ui() {
// Options
var global_perspective = 800; // Global perspective set to parent
var pivot = 80 // The higher this number the more subtle the pivot effect
var debug = false; // Shows various debug information
var animation_delay = 100; // Delay before animation starts cannot be 0. In ms.
var animation_easing = 'ease'; // Animation easing
// Variables
var deep_parent = $('*[data-deep-ui="true"]'); // Parent with deep active
var deep_element = $('[data-depth]'); // Elements with depth
var count = 0;
// Set perspective
deep_parent.each(function() {
$(this).css({
'perspective': global_perspective + 'px',
'transform-style': 'preserve-3d',
'transform': 'translateY(-50%) tra'
}); // Set perspective of parent
// If animation else is turned on, set the transition
if ($(this).data('deep-animate') == true) {
set_depth_animation(); // Set depths
} else {
set_depth(); // Set depths
}
});
// Set the depths of each child element
function set_depth() {
// Set element depth
deep_element.each(function() {
$(this).css({
'transform': 'translatez(' +
$(this).data('depth') +
'px) translateY(-0%)' ,
'transform-style': 'preserve-3d' // Set CSS to all elements
});
});
}
function set_depth_animation() {
// Set element depth
deep_element.each(function() {
$(this).css({
'transform': 'translatez(1000px) translateY(-0%)',
'transform-style': 'preserve-3d' // Set CSS to all elements
});
var deep_animate = 2;
$(this).css('transition', 'all ' + 1.4 + 's ' + (.3 * count) + 's ' + animation_easing); // Set the transition on elements
count++;
});
}
// Pivot
$(document).on('mousemove', function(e) {
var x = -($(window).innerWidth() / 2 - e.pageX) / pivot; // Get current mouse x
var y = ($(window).innerHeight() / 2 - e.pageY) / pivot; // Get current mouse y
deep_parent.css('transform', 'rotateY(' + x + 'deg) rotateX(' + y + 'deg) translateY(-0%)'); // Set parent element rotation
});
// Debug
function deep_debug() {
deep_element.each(function() {
$(this).append('<span class="d_label">Depth: ' + $(this).data('depth') + '</span>'); // Append depth tags
});
deep_parent.each(function() {
$(this).append('<span class="d_b_label">Deep parent</span>'); // Append parent tags
});
}
// Run debug if true
if (debug) {
deep_debug();
}
}
// Init
deep_ui();
!function(){"use strict";var o=[],n=0,e=0,t={window:"object"==typeof window,module:"object"==typeof module&&"object"==typeof module.exports,amd:"function"==typeof define&&define.amd,global:"object"==typeof global},r={defineProp:"undefined"!=typeof Object.defineProperty},a={valuesCount:1e4,randomInterval:30,removeOptions:!0},d={};t.window&&window.fastrandomOptions?d=window.fastrandomOptions:t.global&&global.fastrandomOptions?d=global.fastrandomOptions:"object"==typeof fastrandomOptions&&(d=fastrandomOptions);for(var i in a)a.hasOwnProperty(i)&&!d.hasOwnProperty(i)&&(d[i]=a[i]);d.removeOptions&&(t.window&&window.fastrandomOptions?delete window.fastrandomOptions:t.global&&global.fastrandomOptions&&delete global.fastrandomOptions);var f=function(e){return e?o[e]:(n==d.valuesCount&&(n=0),o[n++])};f.randomChanger=function(){e==d.valuesCount&&(e=0),o[e++]=Math.random()};for(var s=0;s<d.valuesCount;s++)f.randomChanger();d.randomInterval&&setInterval(f.randomChanger,d.randomInterval),f.valueOf=f,f.options=d,r.defineProp&&(Object.defineProperty(f,"random",{get:function(){return f()}}),Object.defineProperty(f,"randomArray",{get:function(){return o}}),Object.defineProperty(f,"currentRandomIndex",{get:function(){return n}})),t.module?module.exports=f:t.amd&&define("fastrandom",[],function(){return f}),t.window&&(window.random=f)}();
class ParticulateUI {
constructor() {
this.elements = [];
}
add(el, render) {
// Add the element to the particulate class ready for render
el.height = Math.floor($(el.elem).outerHeight());
el.width = Math.floor($(el.elem).outerWidth());
el.html = $(el.elem).get(0).outerHTML;
el.render = render;
el.positionX = $(el.elem)[0].getBoundingClientRect().left + $(window)['scrollLeft']();
el.positionY = $(el.elem)[0].getBoundingClientRect().top + $(window)['scrollTop']();
el.pixels = [];
el.data = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${el.width}" height="${el.height}"><foreignObject width="100%" height="100%">${el.html}</foreignObject><defs><style type="text/css">@font-face {font-family: "${primaryFont}"}</style></defs></svg>`;
this.elements.push(el);
}
render() {
// Render the elements
this.elements.forEach(function(element) {
// For each elements create a precursor canvas and append it the body
var preCanvasElement = $('<canvas id="' + element.elem.split('.')[1] + '--pre"/>');
$('.scene').append(preCanvasElement);
// Get the context of this pre canvas
var preCanvas = document.getElementById(element.elem.split('.')[1] + '--pre');
var preCanvasCtx = preCanvas.getContext('2d');
// Hide the pre canvas
if(!element.render) {
$('canvas#' + element.elem.split('.')[1] + '--pre').hide();
}
$('canvas#' + element.elem.split('.')[1] + '--pre').css({'left': element.positionX, 'top' : element.positionY});
// Set the height of the canvas to match the rendered element
preCanvas.height = element.height;
preCanvas.width = element.width;
// Create BLOB from the elements data
var DOMURL = window.URL || window.webkitURL || window;
var img = new Image();
var svg = new Blob([element.data], {type: 'image/svg+xml;charset=utf-8'});
// Read and draw onto our preCanvas
var reader = new FileReader();
reader.readAsDataURL(svg);
reader.onloadend = function() {
img.src = reader.result
img.onload = function () {
// Draw the SVG onto the canvas
preCanvasCtx.drawImage(img, 0, 0);
// Now get the pixel data
for (var y = 0; y < img.height; y += 1.6) {
for (var x = 0; x < img.width; x += 1.6) {
// Get current pixel
let pixel = preCanvasCtx.getImageData(x, y, 1, 1).data;
// Get r,g,b values from pixel
let r = pixel[0],
g = pixel[1],
b = pixel[2],
a = pixel[3]
if(a !== 0) {
// Create a pixel object and stroe that information to it
let pixelData = {
x : x,
y : y,
r : r,
g : g,
b : b,
a : 255,
yv : (random() - 0.5) * 0.8,
xv : (random() - 0.5) * 0.8,
sx : x,
sy : y,
initX : x + $(window).width() / 2 - 50,
initY : y + $(window).height() / 2 - 50,
life : random() * 100
}
// Push this object to a pixel data array
element.pixels.push(pixelData);
}
}
}
console.log(element.pixels.length + ' Total particles');
// Now we have the pixel data, lets create a second canvas and draw on the pixels
// So now we have an array filled with all the pixels in the canvas. We can now draw all of them onto a
// fresh canvas and animate them as we please.
// Let's start off by creating a canvas element and appending it to the target
if(element.render) {
let canvas = document.createElement('canvas');
let ctx = canvas.getContext("2d");
canvas.id = element.elem.split('.')[1];
canvas.width = $(window).width() * 2;
canvas.height = $(window).height() * 2;
// Append the dynamically generated canvas to the target element.
$('.scene').append(canvas);
$('.scene_inner__slider, .wrap').hide();
}
}
}
})
}
}
class ParticulateElement {
constructor(elem) {
this.elem = elem;
this.children = [];
this.render = true;
this.isDispersing = false;
var that = this;
this.draw = function(pixel) {
let canvas = $('#' + that.elem.split('.')[1]).get(0)
let ctx = canvas.getContext("2d");
// ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
let x = pixel.x + that.positionX;
let y = pixel.y + that.positionY;
let r = pixel.r;
let g = pixel.g;
let b = pixel.b;
let a = pixel.a;
ctx.fillRect(x, y, 2, 2);
ctx.fillStyle = `rgba(${r}, ${g}, ${b}, ${a})`; // rgba(10, 10, 10, 255)
ctx.fill();
}
this.morphTo = function(to) {
for(let i = 0; i < this.pixels.length; i++) {
var p = this.pixels[i];
var t = to['pixels'][i];
TweenLite.fromTo(p, 1.78, {
x: p.x,
y: p.y,
}, {
x: t.x,
y: t.y,
ease: Elastic.easeOut.config(1.2, .35),
onUpdateParams: [p],
delay:.0002 * i,
onUpdate: this.draw
});
}
}
this.disperse = function() {
let canvas = $('#' + this.elem.split('.')[1]).get(0)
let ctx = canvas.getContext("2d");
setInterval(function() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
$('canvas#' + this.elem.split('.')[1] + '--pre').hide();
$('canvas#' + this.elem.split('.')[1]).show();
for(let i = 0; i < this.pixels.length; i++) {
var p = this.pixels[i];
if(p.life > 0) {
p.life -= 1;
p.x += p.xv * Math.sin(((150 - p.sx) + 1) / (180 / Math.PI));
p.y += p.yv * Math.sin(((150 - p.sx) + 1) / (180 / Math.PI));
p.yv += ((random() - 0.5) * 8 / 2.4)
p.xv += ((random() - 0.5) * 8 / 2.4)
p.a = ~~(p.life);
}
}
this.pixels.forEach(function(pixel) {
if(pixel.life > 0) {
ctx.beginPath();
let x = pixel.x + this.positionX;
let y = pixel.y + this.positionY;
let r = pixel.r;
let g = pixel.g;
let b = pixel.b;
let a = pixel.a;
ctx.fillRect(x, y, 2, 2);
ctx.fillStyle = `rgba(${r}, ${g}, ${b}, ${a})`; // rgba(10, 10, 10, 255)
ctx.fill();
}
}.bind(this));
}.bind(this), 1000 / 60)
}
}
style(styles) {
// Style the root element
this.styles = styles;
Object.keys(styles).forEach(function(key) {
let property = key;
let value = styles[property];
$(this.elem).css(property, value);
}.bind(this));
}
addChildren(addChildren) {
let children = addChildren.split(',');
children.forEach(function(child) {
this.children[child] = [];
this.children[child].push(child);
}.bind(this))
}
styleChild(elem, styles) {
this.children[elem]['style'] = styles;
// Style child
Object.keys(this.children[elem]['style']).forEach(function(key) {
let property = key;
let value = this.children[elem]['style'][property];
$(this.elem + ' ' + this.children[elem][0]).css(property, value);
}.bind(this));
}
}
/* =========================================================================
Add html to particulateUI
============================================================================ */
// Instanstiate particulateUI
ParticulateUI = new ParticulateUI();
const tileOne = new ParticulateElement('.slide_one');
const tileTwo = new ParticulateElement('.slide_two');
const tileThree = new ParticulateElement('.slide_three');
const tileFour = new ParticulateElement('.slide_four');
const tileFive = new ParticulateElement('.slide_five');
tileOne.style({
'background' : '#000',
'width' : '150px',
'height' : '180px',
'border-radius' : '8px',
'color' : 'white',
'font-family' : 'Lato',
'display' : 'inline-block',
'margin-right' : '10px',
'background' : 'black',
'background-repeat' : 'no-repeat',
'background-image' : "url(" + avengersImage + ")"
});
tileOne.addChildren('.slide_title,.slide_text');
tileOne.styleChild('.slide_title', {
'font-size' : '15px',
'padding' : '70px 20px 0 20px'
});
tileOne.styleChild('.slide_text', {
'font-size' : '12px',
'line-height' : '16px',
'padding' : '0 20px 0 20px',
'opacity' : '0.8'
});
tileTwo.style({
'background' : '#000',
'width' : '150px',
'height' : '180px',
'border-radius' : '8px',
'color' : 'white',
'font-family' : 'Lato',
'display' : 'inline-block',
'margin-right' : '10px',
'background' : 'black',
'background-repeat' : 'no-repeat',
'background-image' : "url(" + readyPlayerOne + ")"
});
tileTwo.addChildren('.slide_title,.slide_text');
tileTwo.styleChild('.slide_title', {
'font-size' : '15px',
'padding' : '70px 20px 0 20px'
});
tileTwo.styleChild('.slide_text', {
'font-size' : '12px',
'line-height' : '16px',
'padding' : '0 20px 0 20px',
'opacity' : '0.8'
});
ParticulateUI.add(tileTwo, true);
tileThree.style({
'background' : '#000',
'width' : '150px',
'height' : '180px',
'border-radius' : '8px',
'color' : 'white',
'font-family' : 'Lato',
'display' : 'inline-block',
'margin-right' : '10px',
'background' : 'black',
'background-repeat' : 'no-repeat',
'background-image' : "url(" + annabelle + ")"
});
tileThree.addChildren('.slide_title,.slide_text');
tileThree.styleChild('.slide_title', {
'font-size' : '15px',
'padding' : '70px 20px 0 20px'
});
tileThree.styleChild('.slide_text', {
'font-size' : '12px',
'line-height' : '16px',
'padding' : '0 20px 0 20px',
'opacity' : '0.8'
});
tileFour.style({
'background' : '#000',
'width' : '150px',
'height' : '180px',
'border-radius' : '8px',
'color' : 'white',
'font-family' : 'Lato',
'display' : 'inline-block',
'margin-right' : '10px',
'background' : 'black',
'background-repeat' : 'no-repeat',
'background-image' : "url(" + phoenix + ")"
});
tileFour.addChildren('.slide_title,.slide_text');
tileFour.styleChild('.slide_title', {
'font-size' : '15px',
'padding' : '70px 20px 0 20px'
});
tileFour.styleChild('.slide_text', {
'font-size' : '12px',
'line-height' : '16px',
'padding' : '0 20px 0 20px',
'opacity' : '0.8'
});
tileFive.style({
'background' : '#000',
'width' : '150px',
'height' : '180px',
'border-radius' : '8px',
'color' : 'white',
'font-family' : 'Lato',
'display' : 'inline-block',
'margin-right' : '10px',
'background' : 'black',
'background-repeat' : 'no-repeat',
'background-image' : "url(" + avengersImage + ")"
});
tileFive.addChildren('.slide_title,.slide_text');
tileFive.styleChild('.slide_title', {
'font-size' : '15px',
'padding' : '70px 20px 0 20px'
});
tileFive.styleChild('.slide_text', {
'font-size' : '12px',
'line-height' : '16px',
'padding' : '0 20px 0 20px',
'opacity' : '0.8'
});
ParticulateUI.add(tileOne, true);
ParticulateUI.add(tileThree, true);
ParticulateUI.add(tileFour, true);
ParticulateUI.add(tileFive, true);
const textOne = new ParticulateElement('.textOne');
textOne.style({
'width' : '300px',
'font-family': 'lato',
'left' : '60px',
'padding-left' : '60px',
'color': 'white',
});
textOne.addChildren('.left_title,.left_description,.left_cta');
textOne.styleChild('.left_title', {
'font-size' : '20px',
'margin-bottom' : '10px'
});
textOne.styleChild('.left_description', {
'font-size': '12px',
'line-height' : '16px',
'opacity': '0.7'
});
textOne.styleChild('.left_cta', {
'padding': '10px 20px 12px 20px',
'border-radius': '4px',
'font-size': '14px',
'color': 'white',
'border' : '2px solid white',
'display' : 'inline-block',
'margin-top' : '20px'
});
ParticulateUI.add(textOne, true);
const textTwo = new ParticulateElement('.textTwo');
textTwo.style({
'width' : '300px',
'font-family': 'lato',
'left' : '60px',
'padding-left' : '60px',
'color': 'white',
});
textTwo.addChildren('.left_title,.left_description,.left_cta');
textTwo.styleChild('.left_title', {
'font-size' : '20px',
'margin-bottom' : '10px'
});
textTwo.styleChild('.left_description', {
'font-size': '12px',
'line-height' : '16px',
'opacity' : '0.7',
});
textTwo.styleChild('.left_cta', {
'padding': '10px 20px 12px 20px',
'border-radius': '4px',
'font-size': '14px',
'color': 'white',
'border' : '2px solid white',
'display' : 'inline-block',
'margin-top' : '20px'
});
ParticulateUI.add(textTwo, true);
const textThree = new ParticulateElement('.textThree');
textThree.style({
'width' : '300px',
'font-family': 'lato',
'left' : '60px',
'padding-left' : '60px',
'color': 'white',
});
textThree.addChildren('.left_title,.left_description,.left_cta');
textThree.styleChild('.left_title', {
'font-size' : '20px',
'margin-bottom' : '10px'
});
textThree.styleChild('.left_description', {
'font-size': '12px',
'line-height' : '16px',
'opacity' : '0.7',
});
textThree.styleChild('.left_cta', {
'padding': '10px 20px 12px 20px',
'border-radius': '4px',
'font-size': '14px',
'color': 'white',
'border' : '2px solid white',
'display' : 'inline-block',
'margin-top' : '20px'
});
ParticulateUI.add(textThree, true);
const textFour = new ParticulateElement('.textFour');
textFour.style({
'width' : '300px',
'font-family': 'lato',
'left' : '60px',
'padding-left' : '60px',
'color': 'white',
});
textFour.addChildren('.left_title,.left_description,.left_cta');
textFour.styleChild('.left_title', {
'font-size' : '20px',
'margin-bottom' : '10px'
});
textFour.styleChild('.left_description', {
'font-size': '12px',
'line-height' : '16px',
'opacity' : '0.7',
});
textFour.styleChild('.left_cta', {
'padding': '10px 20px 12px 20px',
'border-radius': '4px',
'font-size': '14px',
'color': 'white',
'border' : '2px solid white',
'display' : 'inline-block',
'margin-top' : '20px'
});
ParticulateUI.add(textFour, true);
const textFive = new ParticulateElement('.textFive');
textFive.style({
'width' : '300px',
'font-family': 'lato',
'left' : '60px',
'padding-left' : '60px',
'color': 'white',
});
textFive.addChildren('.left_title,.left_description,.left_cta');
textFive.styleChild('.left_title', {
'font-size' : '20px',
'margin-bottom' : '10px'
});
textFive.styleChild('.left_description', {
'font-size': '12px',
'line-height' : '16px',
'opacity' : '0.7',
});
textFive.styleChild('.left_cta', {
'padding': '10px 20px 12px 20px',
'border-radius': '4px',
'font-size': '14px',
'color': 'white',
'border' : '2px solid white',
'display' : 'inline-block',
'margin-top' : '20px'
});
ParticulateUI.add(textFive, true);
// Instanstiate a new particulate element class and attach to DOM node
ParticulateUI.render();
var sliderProgress = 0;
var canClick = true;
$('.arrow').click(function() {
if(canClick) {
canClick = false;
if(sliderProgress < 4) {
sliderProgress++;
$('#slide_one, #slide_one--pre,#slide_two, #slide_two--pre,#slide_three, #slide_three--pre,#slide_four, #slide_four--pre,#slide_five, #slide_five--pre').css('transform' , 'translateX(-' + sliderProgress * 162 + 'px) translateZ(30px)');
}
//textOne.morphTo(textTwo)
if(sliderProgress == 1) {
$('.coverTwo').css('clip-path', 'polygon(0 0, 100% 0, 100% 100%, 0% 100%)')
setTimeout(function(){
tileOne.disperse();
}, 300)
setTimeout(function(){
$('canvas#textTwo, canvas#textTwo--pre').css('opacity', '1')
}, 500)
setTimeout(function(){
canClick = true
}, 1000);
textOne.disperse();
}
if(sliderProgress == 2) {
$('.coverThree').css('clip-path', 'polygon(0 0, 100% 0, 100% 100%, 0% 100%)')
setTimeout(function(){
tileTwo.disperse();
}, 300)
setTimeout(function(){
$('canvas#textThree, canvas#textThree--pre').css('opacity', '1')
}, 500)
setTimeout(function(){
canClick = true
}, 1000);
textTwo.disperse();
}
if(sliderProgress == 3) {
$('.coverFour').css('clip-path', 'polygon(0 0, 100% 0, 100% 100%, 0% 100%)')
setTimeout(function(){
tileThree.disperse();
}, 300)
setTimeout(function(){
$('canvas#textFour, canvas#textFour--pre').css('opacity', '1')
}, 500)
setTimeout(function(){
canClick = true
}, 1000);
textThree.disperse();
}
if(sliderProgress == 4) {
$('.coverFive').css('clip-path', 'polygon(0 0, 100% 0, 100% 100%, 0% 100%)')
setTimeout(function(){
tileFour.disperse();
}, 300)
setTimeout(function(){
$('canvas#textFive, canvas#textFive--pre').css('opacity', '1')
}, 500)
setTimeout(function(){
canClick = true
}, 1000);
textFour.disperse();
}
}
})
$(window).bind('resize',function(){
//window.location.href = window.location.href;
});
Also see: Tab Triggers