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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                
<div class="container">

   <img src="http://www.thesingingtree.biz/wp-content/uploads/2013/08/frame.png">
   <h1 class="title">Happy New Year <br>Everybody</h1>
   <div>
      <p class="wish"> Wish this New Year brings for you lots of joy,
         <br>happiness, good health and indeed wealth. 
         <br>Have a rocking year!</p>
      <p class="name">Dita <span>:)</span></p>
   </div>
</div>

<div id="name-canvas"></div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Bilbo+Swash+Caps|Condiment');

body {
   margin: 0;
   font-family: 'Condiment', cursive;
   background-image: url(https://www.arabiangym.com/wp-content/uploads/2017/12/snow.jpg);
   background-repeat: no-repeat;
   background-size: cover;
   background-attachment: fixed;
}

.container {
   text-align: center;
   position: absolute;
   background: rgba(177, 200, 214, 0.7); 
   width: 480px;
   top: 50%;
   left: 50%;
   transform: translateX(-50%) translateY(-50%);
   height: 375px;
   z-index: 1; 
   font-family: 'Bilbo Swash Caps', cursive;
}

#name-canvas {
   perspective: 1000px;
   position: absolute;
   top: 0;
   left: 0;
   z-index: 1;
   width: 100%;
   height: 100vh;
   overflow: hidden;
   z-index: -1;
}

.mover {
   position: absolute;
   z-index: -1;
}

img {
   top: 50%;
   left: 50%;
   transform: translateX(-50%) translateY(-50%);
   height: 800px;
   width: 900px;
   z-index: 2;
   position: absolute;
}

.title {
   padding-top: 30px;
   font-weight: bold;
   font-size: 40px;
   z-index: 2;
   color: #063f5b;
}

.wish {
   font-weight: bold;
   font-size: 30px;
   color: #063f5b;
   margin: 0;
}

.name {
   font-size: 30px;
   float: right;
   padding-right: 30px;
   color: #063f5b;
}

@media screen and (max-width: 800px) {     
   img {
      width: 500px;
      height: 570px; 
   }
   .title {
      padding-top: 20px;
      font-weight: bold;
      font-size: 30px;
   }

   .wish {
      padding-top: 30px;
      font-size: 15px;
   }

   .name {
      font-size: 15px;
      padding-right: 20px;
   }
   .container {
      width: 300px;
      height: 270px;
   }
}
@media screen and (max-width: 600px) {     
   img {
      width: 400px;
      height: 570px; 
   }
   .title {
      padding-top: 10px;
      font-size: 20px;
   }

   .wish {
      padding-top: 30px;
      font-size: 15px;
   }

   .name {
      font-size: 15px;
      padding-right: 20px;
   }
   .container {
      width: 210px;
      height: 270px;
      background: rgba(177, 200, 214, 0.7);
   }
}
              
            
!

JS

              
                var mouse = {
   x: undefined,
   y: undefined
}

//Get mouse x and y coordinates
window.addEventListener('mousemove', function(event) {
   mouse.x = event.x;
   mouse.y = event.y;
});

var colorArray = [
   'white',
   '#357291',
   '#949799',
   '#547b8e',
   '#063f5b'
];

var nameArray = [
   'Hyvää uutta vuotta 2018', 'Gelukkige Nuwe Jaar', 'Gëzuar Vitin e Ri', 'سنة جديدة سعيدة', 'Շնորհավոր Նոր Տարի',
   'З Новым годам', 'শুভ নব বর্ষ', 'Sretna Nova godina', 'Честита Нова Година', 'Bon any nou', '新年快乐', 
   'Sretna Nova godina', 'Šťastný nový rok', 'gelukkig nieuw jaar', 'Head uut aastat',
   'Happy New Year', 'Feliĉan novan jaron', 'Eƒé bé dzogbenyui nami', 'Mbembe mbu',
   'Godt nytår', 'Gott nýggjár', 'Manigong bagong taon', 'Gelukkig nieuwjaar', 'Mikudo xwe yoyo ', 'Bonne année',
   'lokkich nijjier', 'bon an', 'Dioul mo wouri', 'Feliz ano novo', 'გილოცავთ ახალ წელს', 'Frohes neues Jahr', 'Καλή Χρονιά', 'Rogüerohory año nuévo-re', 'Sal mubarak', 'Bònn ané', 'Barka da sabuwar shekara', 'Hauoli makahiki hou', 'שנה טובה',
   'Ombura ombe ombua', 'Nav varsh ki subhkamna', 'Nyob zoo xyoo tshiab', 'Boldog új évet', 'Gleðilegt nýtt ár', 'Selamat tahun baru', 'ᐅᑭᐅᒥ ᓄᑖᒥ ᖁᕕᐊᓱᒋᑦᓯ', 
   'Ath bhliain faoi mhaise', 'Felice anno nuovo', 'あけまして おめでとう ございます', 'Sugeng warsa enggal', 'Aseggas ameggaz', 'ಹೊಸ ವರ್ಷದ ಹಾರ್ಧಿಕ ಶುಭಾಶಯಗಳು', 'Nav reh mubarakh', 
   'Zhana zhiliniz kutti bolsin', 'Ngethi cya mwaka mweru', '새해 복 많이 받으세요', 'Sala we ya nû pîroz be', 'Sabai di pi mai', 'Felix sit annus novus', 'Laimīgu Jauno gadu', 'Weli Newiyal',
   'Bón ànno nêuvo', 'Laimingų Naujųjų Metų', 'Gelükkig nyjaar', 'E gudd neit Joër', 'Среќна Нова Година', 'Selamat tahun baru', 'Is-sena t-tajba', 'Kia porotu te ano ou', 'नयाँ बर्षको शुभकामना', 
   'Godt nyttår', 'سال نو مبارک', 'Szczęśliwego nowego roku', 'Feliz ano novo', 'La mulţi ani', 'Bun di bun onn', 'С Новым Годом', 'Bliadhna mhath ur',
   'Срећна Нова година', 'Goredzva rakanaka', 'Šťastný nový rok', 'Gott nytt år', 'Es guets Nöis', 'Es guets Nöis', 'Щасливого Нового Року', 
   'Ene boune anéye, ene boune sintéye', 'Nyak\'omtsha', '2018', '2018', '2018', '2018', '2018', '2018', '2018',
   '2018', '2018', '2018', '2018', '2018', '2018', '2018'
];

var container = document.querySelector('#name-canvas');
var nameMovers = [];
var vHeight = window.innerHeight;
var vWidth = window.innerWidth;

var mover;
for (var i = 0; i < nameArray.length; i++) {
   mover = createMover(nameArray[i], container);
   nameMovers.push(mover);
}

animate();

function randPos(max) {
    return Math.floor(Math.random() * max);
}

function randMinMax(min, max, nonZero) {
   var value = Math.floor(Math.random() * (max - (min))) + (min);
   
   if (nonZero && value === 0) {
      return randMinMax(min, max, nonZero);
   } else {
      return value;
   }
}


function createMover(name, container) {
   var mover = {
      x: randPos(vWidth),
      y: randPos(vHeight),
      z: randPos(100),
      dx: randMinMax(-2, 3, true) / 1.5,
      dy: randMinMax(-2, 3, true) / 2,
      dz: randMinMax(-2, 3, true),
   };

   //Colors randomly from color array
   var color = colorArray[Math.floor(Math.random() * colorArray.length)];
  
   var el = document.createElement('div');
   el.innerHTML = name;
   el.classList.add('mover');
   el.style.color = color;
   mover.el = el;
   container.appendChild(el);
   return mover;
}


function updateMoverPosition(mover) {
   mover.x += mover.dx;
   mover.y += mover.dy;
   mover.z += mover.dz;
   
   // bounce back.
   if (mover.x >= window.innerWidth || mover.x < 0) {
      mover.dx = -mover.dx;
   }
   if (mover.y >= window.innerHeight || mover.y < 0) {
      mover.dy = -mover.dy;
   }
   if (mover.z >= 500 || mover.z < -500) {
      mover.dz = -mover.dz;
   }
   
   mover.el.style.transform = [
      "translateX("  + mover.x + "px)",
      "translateY("  + mover.y + "px)",
      "translateZ("  + mover.z + "px)"
   ].join('');
      
   
}

//for moving names around
function animate() {
   
   for (let i = 0; i < nameMovers.length; i++) {
      updateMoverPosition(nameMovers[i]);
   }  
   
   //setTimeout(animate, 1000 / 50);
   requestAnimationFrame(animate);
}



              
            
!
999px

Console