Johannes Zellner před 10 roky
revize
48ecd725c2
5 změnil soubory, kde provedl 143 přidání a 0 odebrání
  1. 49 0
      beam.css
  2. 53 0
      beam.js
  3. 19 0
      createContent.js
  4. 21 0
      index.html
  5. 1 0
      jquery-3.1.1.min.js

+ 49 - 0
beam.css

@@ -0,0 +1,49 @@
+
+html, body {
+    margin: 0;
+    padding: 0;
+    width: 100%;
+    height: 100%;
+    background-color: black;
+}
+
+container {
+    display: block;
+    position: relative;
+    width: 100%;
+    height: 100%;
+    background-color: black;
+}
+
+content {
+    display: inline-block;
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+    background-size: fill;
+    background-position: center;
+    background-repeat: no-repeat;
+}
+
+.animation-hueify {
+    animation-duration: 5s;
+    animation-name: hueify;
+    animation-timing-function: linear;
+    animation-iteration-count: infinite;
+}
+
+@keyframes hueify {
+    0% {
+        filter: hue-rotate(0deg);
+    }
+
+    50% {
+        filter: hue-rotate(180deg);
+    }
+
+    100% {
+        filter: hue-rotate(0deg);
+    }
+}

+ 53 - 0
beam.js

@@ -0,0 +1,53 @@
+$(function () {
+    'use strict';
+
+    var container = $('container');
+    var contentContainer0 = $('#content0');
+    var contentContainer1 = $('#content1');
+
+    var curContentContainer = contentContainer0;
+    var nextContentContainer = contentContainer1;
+
+    var content = [];
+
+    function preload(imageUrl, callback) {
+        var img = new Image();
+        img.onload = function () {
+            callback();
+        };
+        img.src = imageUrl;
+    }
+
+    function random(values) {
+        return values[Number.parseInt(Math.random()*values.length)];
+    }
+
+    function showNext() {
+        var img = random(content);
+
+        preload(img, function () {
+            nextContentContainer.css('background-image', 'url("' + img + '")');
+            nextContentContainer.css('background-repeat', random(['no-repeat', 'space', 'repeat']));
+            nextContentContainer.css('background-size', random(['cover', 'contain', 'unset', '50%', '120%', '30%']));
+
+            if (random(['fade', 'slide']) === 'fade') {
+                curContentContainer.fadeOut();
+                nextContentContainer.fadeIn();
+            } else {
+                curContentContainer.slideToggle();
+                nextContentContainer.slideToggle();
+            }
+
+            var tmp = nextContentContainer;
+            nextContentContainer = curContentContainer;
+            curContentContainer = tmp;
+
+            setTimeout(showNext, 3000);
+        });
+    }
+
+    $.get('/content.json', function (data) {
+        content = data.content.map(function (img) { return img.replace('http://', 'https://'); }).map(function (img) { return img.replace('_75sq', '_500'); });
+        showNext();
+    });
+});

+ 19 - 0
createContent.js

@@ -0,0 +1,19 @@
+
+var fs = require('fs'),
+    http = require('http');
+
+http.get('http://archillect.com/', function (res) {
+    var body = '';
+
+    res.on('data', function (chunk) {
+        body += chunk;
+    });
+
+    res.on('end', function () {
+        var geturl = new RegExp('(^|[ \t\r\n])((http|https):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-]))' ,'g');
+        var urls = body.match(geturl).filter(function (url) { return (url.indexOf('media.tumblr.com') > 0); }).map(function (url) { return url.trim(); });
+        fs.writeFileSync('./content.json', JSON.stringify({ content: urls }));
+    });
+}).on('error', function (e) {
+    console.error('Failed to fetch', e);
+});

+ 21 - 0
index.html

@@ -0,0 +1,21 @@
+<html>
+<head>
+	<title> B E A M </title>
+
+	<link rel="stylesheet" href="beam.css">
+
+</head>
+
+<body>
+
+<container>
+	<content id="content0" class="animation-hueify"></content>
+	<content id="content1" class="animation-hueify"></content>
+</container>
+
+<script src="jquery-3.1.1.min.js"></script>
+<script src="beam.js"></script>
+
+</body>
+
+</html>

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 0
jquery-3.1.1.min.js


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů