ForumD.ru - Дизайн, графика, скрипты, техническая поддержка для форумов и сайтов

Объявление

🔴 МАСТЕР-КЛАСС от magia "Жизненный цикл проекта"

Дата и время: начало 28 апреля в 16:00 по МСК;
Если у вас возникла идея создать ролевую игру, сообщество любителей собак или форум для киноманов,
но не знаете с чего начать и что делать, не беда! Мы здесь чтобы помочь.

Подробности

GEMcross

Кроссовер, ориентированный на активную игру и уютный флуд.
Собираем у себя драгоценных игроков уже почти три года.

Посетить

🔥 Новинка в портфолио: ДИЗАЙН И ГРАФИКА В СТИЛЕ GENSHIN IMPACT

Платформа: MyBB.ru (RusFF)
Стоимость: 6500 рублей;
Авторы: Moju & wasurenagusa

Посмотреть

💰 Теперь у нас можно приобрести "Мгновенные уведомления от Алекса"

Скрипт оповещает пользователей о событиях на форуме в реальном времени, придавая динамики общению.
Автор: Alex_63 | Платформа: MyBB.ru.

У нас: структурированная документация, возможность платить иностранными картами, перевыпустить подписку или купить бессрочно.

Купить скрипт

🌟 ОПЛАТА ЗАКАЗА НАГРАДНЫМИ БАЛЛАМИ И СКИДКИ

Заказы можно оплачивать наградными баллами (НБ). Полностью или частично.
Бартер за НБ осуществляется на условиях платного заказа, в качестве оплаты - НБ.
А если у вас есть любой платный заказ, вы можете обменять НБ на скидочные купоны.

узнать подробности

📣 Наш проект: Ролевой поисковик

Поиск роли на текстовых ролевых
Проект от специалистов FD

Спойлеры и обсуждение

❤️ Поддержать проект

Если у вас есть желание помочь нам сделать наш проект лучше:
Реклама на сайтеПредложения
Стать модераторомОтзывы

Подробнее

SPECIAL OFFER: We distribute designs for free

Finalizing the layout for your project;
Developing a style code;
Mobile version included if you wish.

Details

Support the project

If you want to help us:
Become a moderator
SuggestionsReviews

Details
❗ ❗ ❗ Technical work is underway. We'll fix it soon. :) If you're english-speaker and want to use our forum, switch to the russian language. This is temporary, until the works with multi-language option will be done. Sorry for the inconvenience.

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.



Эксперименты Will O The Wisp

Сообщений 111 страница 120 из 187

111

если кому-то интересен скрипт летающих точек, то есть такой
рабочий!

Скрипт в блокнотик, форму, куда рука дрогнет
блок в место
<div id="particles"></div>
в коде все комментировано, понятно
меняется цвет, количество, размер, соединение

Код:
<script>
/*
 * @author  - @sebagarcia
 * @version 1.1.0
 * Inspired & based on "Particleground" by Jonathan Nicol
 */

;(function(window, document) {
  "use strict";
  var pluginName = 'particleground';

  // http://youmightnotneedjquery.com/#deep_extend
  function extend(out) {
    out = out || {};
    for (var i = 1; i < arguments.length; i++) {
      var obj = arguments[i];
      if (!obj) continue;
      for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
          if (typeof obj[key] === 'object')
            deepExtend(out[key], obj[key]);
          else
            out[key] = obj[key];
        }
      }
    }
    return out;
  };

  var $ = window.jQuery;

  function Plugin(element, options) {
    var canvasSupport = !!document.createElement('canvas').getContext;
    var canvas;
    var ctx;
    var particles = [];
    var raf;
    var mouseX = 0;
    var mouseY = 0;
    var winW;
    var winH;
    var desktop = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i);
    var orientationSupport = !!window.DeviceOrientationEvent;
    var tiltX = 0;
    var pointerX;
    var pointerY;
    var tiltY = 0;
    var paused = false;

    options = extend({}, window[pluginName].defaults, options);

    /**
     * Init
     */
    function init() {
      if (!canvasSupport) { return; }

      //Create canvas
      canvas = document.createElement('canvas');
      canvas.className = 'pg-canvas';
      canvas.style.display = 'block';
      element.insertBefore(canvas, element.firstChild);
      ctx = canvas.getContext('2d');
      styleCanvas();

      // Create particles
      var numParticles = Math.round((canvas.width * canvas.height) / options.density);
      for (var i = 0; i < numParticles; i++) {
        var p = new Particle();
        p.setStackPos(i);
        particles.push(p);
      };

      window.addEventListener('resize', function() {
        resizeHandler();
      }, false);

      document.addEventListener('mousemove', function(e) {
        mouseX = e.pageX;
        mouseY = e.pageY;
      }, false);

      if (orientationSupport && !desktop) {
        window.addEventListener('deviceorientation', function () {
          // Contrain tilt range to [-30,30]
          tiltY = Math.min(Math.max(-event.beta, -30), 30);
          tiltX = Math.min(Math.max(-event.gamma, -30), 30);
        }, true);
      }

      draw();
      hook('onInit');
    }

    /**
     * Style the canvas
     */
    function styleCanvas() {
      canvas.width = element.offsetWidth;
      canvas.height = element.offsetHeight;
      ctx.fillStyle = options.dotColor;
      ctx.strokeStyle = options.lineColor;
      ctx.lineWidth = options.lineWidth;
    }

    /**
     * Draw particles
     */
    function draw() {
      if (!canvasSupport) { return; }

      winW = window.innerWidth;
      winH = window.innerHeight;

      // Wipe canvas
      ctx.clearRect(0, 0, canvas.width, canvas.height);

      // Update particle positions
      for (var i = 0; i < particles.length; i++) {
        particles[i].updatePosition();
      };
      // Draw particles
      for (var i = 0; i < particles.length; i++) {
        particles[i].draw();
      };

      // Call this function next time screen is redrawn
      if (!paused) {
        raf = requestAnimationFrame(draw);
      }
    }

    /**
     * Add/remove particles.
     */
    function resizeHandler() {
      // Resize the canvas
      styleCanvas();

      var elWidth = element.offsetWidth;
      var elHeight = element.offsetHeight;

      // Remove particles that are outside the canvas
      for (var i = particles.length - 1; i >= 0; i--) {
        if (particles[i].position.x > elWidth || particles[i].position.y > elHeight) {
          particles.splice(i, 1);
        }
      };

      // Adjust particle density
      var numParticles = Math.round((canvas.width * canvas.height) / options.density);
      if (numParticles > particles.length) {
        while (numParticles > particles.length) {
          var p = new Particle();
          particles.push(p);
        }
      } else if (numParticles < particles.length) {
        particles.splice(numParticles);
      }

      // Re-index particles
      for (i = particles.length - 1; i >= 0; i--) {
        particles[i].setStackPos(i);
      };
    }

    /**
     * Pause particle system
     */
    function pause() {
      paused = true;
    }

    /**
     * Start particle system
     */
    function start() {
      paused = false;
      draw();
    }

    /**
     * Particle
     */
    function Particle() {
      this.stackPos;
      this.active = true;
      this.layer = Math.ceil(Math.random() * 3);
      this.parallaxOffsetX = 0;
      this.parallaxOffsetY = 0;
      // Initial particle position
      this.position = {
        x: Math.ceil(Math.random() * canvas.width),
        y: Math.ceil(Math.random() * canvas.height)
      }
      // Random particle speed, within min and max values
      this.speed = {}
      switch (options.directionX) {
        case 'left':
          this.speed.x = +(-options.maxSpeedX + (Math.random() * options.maxSpeedX) - options.minSpeedX).toFixed(2);
          break;
        case 'right':
          this.speed.x = +((Math.random() * options.maxSpeedX) + options.minSpeedX).toFixed(2);
          break;
        default:
          this.speed.x = +((-options.maxSpeedX / 2) + (Math.random() * options.maxSpeedX)).toFixed(2);
          this.speed.x += this.speed.x > 0 ? options.minSpeedX : -options.minSpeedX;
          break;
      }
      switch (options.directionY) {
        case 'up':
          this.speed.y = +(-options.maxSpeedY + (Math.random() * options.maxSpeedY) - options.minSpeedY).toFixed(2);
          break;
        case 'down':
          this.speed.y = +((Math.random() * options.maxSpeedY) + options.minSpeedY).toFixed(2);
          break;
        default:
          this.speed.y = +((-options.maxSpeedY / 2) + (Math.random() * options.maxSpeedY)).toFixed(2);
          this.speed.x += this.speed.y > 0 ? options.minSpeedY : -options.minSpeedY;
          break;
      }
    }

    /**
     * Draw particle
     */
    Particle.prototype.draw = function() {
      // Draw circle
      ctx.beginPath();
      ctx.arc(this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY, options.particleRadius / 2, 0, Math.PI * 2, true);
      ctx.closePath();
      ctx.fill();

      // Draw lines
      ctx.beginPath();
      // Iterate over all particles which are higher in the stack than this one
      for (var i = particles.length - 1; i > this.stackPos; i--) {
        var p2 = particles[i];

        // Pythagorus theorum to get distance between two points
        var a = this.position.x - p2.position.x
        var b = this.position.y - p2.position.y
        var dist = Math.sqrt((a * a) + (b * b)).toFixed(2);

        // If the two particles are in proximity, join them
        if (dist < options.proximity) {
          ctx.moveTo(this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY);
          if (options.curvedLines) {
            ctx.quadraticCurveTo(Math.max(p2.position.x, p2.position.x), Math.min(p2.position.y, p2.position.y), p2.position.x + p2.parallaxOffsetX, p2.position.y + p2.parallaxOffsetY);
          } else {
            ctx.lineTo(p2.position.x + p2.parallaxOffsetX, p2.position.y + p2.parallaxOffsetY);
          }
        }
      }
      ctx.stroke();
      ctx.closePath();
    }

    /**
     * update particle position
     */
    Particle.prototype.updatePosition = function() {
      if (options.parallax) {
        if (orientationSupport && !desktop) {
          // Map tiltX range [-30,30] to range [0,winW]
          var ratioX = (winW - 0) / (30 - -30);
          pointerX = (tiltX - -30) * ratioX + 0;
          // Map tiltY range [-30,30] to range [0,winH]
          var ratioY = (winH - 0) / (30 - -30);
          pointerY = (tiltY - -30) * ratioY + 0;
        } else {
          pointerX = mouseX;
          pointerY = mouseY;
        }
        // Calculate parallax offsets
        this.parallaxTargX = (pointerX - (winW / 2)) / (options.parallaxMultiplier * this.layer);
        this.parallaxOffsetX += (this.parallaxTargX - this.parallaxOffsetX) / 10; // Easing equation
        this.parallaxTargY = (pointerY - (winH / 2)) / (options.parallaxMultiplier * this.layer);
        this.parallaxOffsetY += (this.parallaxTargY - this.parallaxOffsetY) / 10; // Easing equation
      }

      var elWidth = element.offsetWidth;
      var elHeight = element.offsetHeight;

      switch (options.directionX) {
        case 'left':
          if (this.position.x + this.speed.x + this.parallaxOffsetX < 0) {
            this.position.x = elWidth - this.parallaxOffsetX;
          }
          break;
        case 'right':
          if (this.position.x + this.speed.x + this.parallaxOffsetX > elWidth) {
            this.position.x = 0 - this.parallaxOffsetX;
          }
          break;
        default:
          // If particle has reached edge of canvas, reverse its direction
          if (this.position.x + this.speed.x + this.parallaxOffsetX > elWidth || this.position.x + this.speed.x + this.parallaxOffsetX < 0) {
            this.speed.x = -this.speed.x;
          }
          break;
      }

      switch (options.directionY) {
        case 'up':
          if (this.position.y + this.speed.y + this.parallaxOffsetY < 0) {
            this.position.y = elHeight - this.parallaxOffsetY;
          }
          break;
        case 'down':
          if (this.position.y + this.speed.y + this.parallaxOffsetY > elHeight) {
            this.position.y = 0 - this.parallaxOffsetY;
          }
          break;
        default:
          // If particle has reached edge of canvas, reverse its direction
          if (this.position.y + this.speed.y + this.parallaxOffsetY > elHeight || this.position.y + this.speed.y + this.parallaxOffsetY < 0) {
            this.speed.y = -this.speed.y;
          }
          break;
      }

      // Move particle
      this.position.x += this.speed.x;
      this.position.y += this.speed.y;
    }

    /**
     * Setter: particle stacking position
     */
    Particle.prototype.setStackPos = function(i) {
      this.stackPos = i;
    }

    function option (key, val) {
      if (val) {
        options[key] = val;
      } else {
        return options[key];
      }
    }

    function destroy() {
      console.log('destroy');
      canvas.parentNode.removeChild(canvas);
      hook('onDestroy');
      if ($) {
        $(element).removeData('plugin_' + pluginName);
      }
    }

    function hook(hookName) {
      if (options[hookName] !== undefined) {
        options[hookName].call(element);
      }
    }

    init();

    return {
      option: option,
      destroy: destroy,
      start: start,
      pause: pause
    };
  }

  window[pluginName] = function(elem, options) {
    return new Plugin(elem, options);
  };

  window[pluginName].defaults = {
    minSpeedX: 0.1,
    maxSpeedX: 0.7,
    minSpeedY: 0.1,
    maxSpeedY: 0.7,
    directionX: 'center', // 'center', 'left' or 'right'. 'center' = dots bounce off edges
    directionY: 'center', // 'center', 'up' or 'down'. 'center' = dots bounce off edges
    density: 1000, // How many particles will be generated: one particle every n pixels
    dotColor: '#666666',
    lineColor: '#666666',
    particleRadius: 5, // Dot size
    lineWidth: 1,
    curvedLines: false,
    proximity: 30, // How close two dots need to be before they join
    parallax: true,
    parallaxMultiplier: 3, // The lower the number, the more extreme the parallax effect
    onInit: function() {},
    onDestroy: function() {}
  };

  // nothing wrong with hooking into jQuery if it's there...
  if ($) {
    $.fn[pluginName] = function(options) {
      if (typeof arguments[0] === 'string') {
        var methodName = arguments[0];
        var args = Array.prototype.slice.call(arguments, 1);
        var returnVal;
        this.each(function() {
          if ($.data(this, 'plugin_' + pluginName) && typeof $.data(this, 'plugin_' + pluginName)[methodName] === 'function') {
            returnVal = $.data(this, 'plugin_' + pluginName)[methodName].apply(this, args);
          }
        });
        if (returnVal !== undefined){
          return returnVal;
        } else {
          return this;
        }
      } else if (typeof options === "object" || !options) {
        return this.each(function() {
          if (!$.data(this, 'plugin_' + pluginName)) {
            $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
          }
        });
      }
    };
  }

})(window, document);

/**
 * requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
 * @see: http://paulirish.com/2011/requestanimationframe-for-smart-animating/
 * @see: http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
 * @license: MIT license
 */
(function() {
    var lastTime = 0;
    var vendors = ['ms', 'moz', 'webkit', 'o'];
    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
      window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
      window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
                                 || window[vendors[x]+'CancelRequestAnimationFrame'];
    }

    if (!window.requestAnimationFrame)
      window.requestAnimationFrame = function(callback, element) {
        var currTime = new Date().getTime();
        var timeToCall = Math.max(0, 16 - (currTime - lastTime));
        var id = window.setTimeout(function() { callback(currTime + timeToCall); },
          timeToCall);
        lastTime = currTime + timeToCall;
        return id;
      };

    if (!window.cancelAnimationFrame)
      window.cancelAnimationFrame = function(id) {
        clearTimeout(id);
      };
}());

document.addEventListener('DOMContentLoaded', function () {
  particleground(document.getElementById('particles'), {
    dotColor: '#8299f6',
    lineColor: '#8299f6'
  });
  var intro = document.getElementById('intro');
  intro.style.marginTop = - intro.offsetHeight / 2 + 'px';
}, false);

</script>

https://forumupload.ru/uploads/0007/e3/f7/7629/487201.jpg
примерно так:

Код:
<div id="particles" style="z-index: 1;position: absolute;width: 900px;height: 55px;background: radial-gradient(circle, rgb(12, 94, 79) 0%, rgba(205, 228, 233, 0) 47%, rgb(228, 228, 228) 89%), url(https://i.pinimg.com/474x/51/e4/04/51e40493e691c284b617dc04017fc5e4.jpg);margin: -250px 0px 0px 60px;border: 2px solid #fff;"><h17 style="position: absolute;color: #fff;width: 900px;text-align: center;font-size: 22px;margin: -50px;text-shadow: 2px 2px 2px #720808, 2px 2px 2px #8299f6, 2px 2px 2px #7d1dbf, 2px 2px 2px #f33;"> omnis iste natus error</h17>
</div>

+3

112

Скрипт для алфавитного указателя с фильтром
массив внутри скрипта, через запятую, ссылки туда не вставляются

Код:
[html]
<style>
.card {
	min-height: 20px;
	padding: 15px;
	border: 1px solid #ccc;
	margin-bottom: 30px;
background: #ccc;
background-image: url(https://i.pinimg.com/564x/a3/20/d1/a320d1cbe51961aa1d675948253ef132.jpg);
background-repeat: no-repeat;
background-size: cover;
background-blend-mode: overlay;
background-position: bottom;
color: #fff;
text-shadow: 2px 2px 2px #000;
}
.alphabet li a {
	font-weight: bold;
}
.alphabet li a:not(.view-all) {
	color: #000;
	opacity: .3;
}
</style>
<script>
$(document).ready(function() {
	//HTML Setup
	var servicesArray = ["A Song OF ICE AND FIRE: XXXX, XXX, FFF", "BLEACH", "boku no hero academia", "BORDERLANDS", "BUBBLE COMICS", "DEATH NOTE", "DETROIT: BECOME HUMAN"];

	for (var i = 0; i < servicesArray.length; i++) {
    $(".services").append("<article class='col-sm-4' data-title='" + servicesArray[i] + "'><div class='card'>" + servicesArray[i] + "</div></article>");
	}
	
	//Actual logic
	
	//Bold only the letters of services available
	for (var c = 0; c < $("article").length; c++) {
    var serviceTitle = $("article:eq("+c+")").text(),
    	firstChar = serviceTitle.charAt(0);
    
    for (var a = 0; a < 26; a++) {
    	if ($(".alphabet li:eq("+a+") a").text() == firstChar) {
        $(".alphabet li:eq("+a+") a").css("opacity","1");
    	}
    }
	}
	
	//Filter logic
	$("ul li a").click(function(e) {
    e.preventDefault();
    
    //Get letter that was clicked
    var letter = $(this).text();
    
    //If view all, show all cards, else hide all cards and show ones that start with the letter
    if (letter == "View all") {
    	$("article").show();
    	$(".filtered-by").html("");
    } else {
    	$("article").hide();
    	
    	//Show letter filtered by
    	$(".filtered-by").html('<p>Filtered by the letter <strong>"' + letter + '"</strong></p>');

    	//loop through cards, find first letter match
    	for (var j = 0; j < $("article").length; j++) {
        var serviceTitle = $("article:eq("+j+")").data("title");

        if (serviceTitle.indexOf(letter) == 0) {
        	$("article:eq("+j+")").show();
        }
    	}
    }
	});
});
</script>
<div class="container">
	<div class="row">
    <div class="col-sm-12">
    	<ul class="list-unstyled list-inline alphabet" style="display: ruby;padding:20px;">
        <li><a href="#" class="view-all">View all</a></li>
        <li><a href="#">A</a></li>
        <li><a href="#">B</a></li>
        <li><a href="#">C</a></li>
        <li><a href="#">D</a></li>
        <li><a href="#">E</a></li>
        <li><a href="#">F</a></li>
        <li><a href="#">G</a></li>
        <li><a href="#">H</a></li>
        <li><a href="#">I</a></li>
        <li><a href="#">J</a></li>
        <li><a href="#">K</a></li>
        <li><a href="#">L</a></li>
        <li><a href="#">N</a></li>
        <li><a href="#">M</a></li>
        <li><a href="#">O</a></li>
        <li><a href="#">P</a></li>
        <li><a href="#">Q</a></li>
        <li><a href="#">R</a></li>
        <li><a href="#">S</a></li>
        <li><a href="#">T</a></li>
        <li><a href="#">U</a></li>
        <li><a href="#">V</a></li>
        <li><a href="#">W</a></li>
        <li><a href="#">X</a></li>
        <li><a href="#">Y</a></li>
        <li><a href="#">Z</a></li>
    	</ul>
    </div>
	</div>
	<div class="filtered-by">
    
	</div>
	<div class="row services">

	</div>
</div>

[/html]

+4

113

Will O The Wisp
это теперь мой любимый топик на ФД.  :love:
спасибо тебе за ресерч - такие интересные штуковины ты ковыряешь!  :cool:

+2

114

Gerda
нет бы скажи свой шаблон отредактировал, закончил хоть что-то, перебрал кучи хтмл шаблонов для анкет, тем, списков, тестовик почистил
но вот спамлю всем подряд без системы :3
скажи, если что надо пополнить по разделам

0

115

а пока
развлеките посетителей вашей личной сообщением с облаками

Код:
[html]
<style>
*{
  margin: 0;
  padding: 0;
  overflow:hidden;
}

body {
 background:#333; 
}

#reset {
  position: absolute;
  left:50%;
  top:10px;
  margin-left:-400px;
  background: #444;
  border: 1px solid #555;
  color: #888;
  padding: 6px 10px;
  cursor: pointer;
  opacity: 0.8;
}

#c {
  width:800px;
  height:376px;
  margin:0 auto;
  display:block;
}

#info {
  position:absolute;
  left:-1px;
  top:-1px;
  width:auto;
  max-width:380px;
  height:auto;
  background:#f2f2f2;
  border-bottom-right-radius:10px;
}

#top {
  background:#fff;
  width:100%;
  height:auto;
  position:relative;
  border-bottom:1px solid #eee;
}

p {
  font-family:Arial, sans-serif;
  color:#666;
  text-align:justify;
  font-size: 16px;
  margin:10px;
}

a {
  font-family:sans-serif;
  color:#444;
  text-decoration:none;
  font-size: 20px;
}

#site {
  float:left;
  margin: 10px;
  color: #38a;
}

#close {
  float:right;
  margin: 10px;
}
</style>
<script>
/*
Copyright (c) 2013 dissimulate at codepen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

document.getElementById('close').onmousedown = function(e) {
  e.preventDefault();
  document.getElementById('info').style.display = 'none';
  return false;
};

/* Settings */

var MOUSE_INFLUENCE = 5,
    GRAVITY_X     = 0,
    GRAVITY_Y     = 0,
    MOUSE_REPEL   = false,
    GROUPS        = [50,50,50],
    GROUP_COLOURS = ['rgba(97,160,232'];

window.requestAnimFrame =
window.requestAnimationFrame       || 
window.webkitRequestAnimationFrame || 
window.mozRequestAnimationFrame    || 
window.oRequestAnimationFrame      || 
window.msRequestAnimationFrame     ||
function( callback ){
    window.setTimeout(callback, 1000 / 60);
};

var fluid = function() {
    
    var ctx, width, height, num_x, num_y, particles, grid, meta_ctx, threshold = 220, play = false, spacing = 45, radius = 30, limit = radius * 0.66, textures, num_particles;

    var mouse = {
        down: false,
        x: 0,
        y: 0
    };

    var process_image = function() {
        var imageData = meta_ctx.getImageData(0, 0, width, height),
            pix = imageData.data;

        for (var i = 0, n = pix.length; i < n; i += 4) {
            (pix[i + 3] < threshold) && (pix[i + 3] /= 6);
        }

        ctx.putImageData(imageData, 0, 0);
    };

    var run = function () {

        //var time = new Date().getTime();
        meta_ctx.clearRect(0, 0, width, height);

        for (var i = 0, l = num_x * num_y; i < l; i++) grid[i].length = 0;
        

        var i = num_particles;
        while(i--) particles[i].first_process();
        i = num_particles;
        while(i--) particles[i].second_process();

        process_image();

        if(mouse.down) {

            ctx.canvas.style.cursor = 'none';

            ctx.fillStyle = 'rgba(97, 160, 232, 0.05)';
            ctx.beginPath();
            ctx.arc(
                mouse.x,
                mouse.y,
                radius * MOUSE_INFLUENCE,
                0,
                Math.PI * 2
                );
            ctx.closePath();
            ctx.fill();

            ctx.fillStyle = 'rgba(97, 160, 232, 0.05)';
            ctx.beginPath();
            ctx.arc(
                mouse.x,
                mouse.y,
                (radius * MOUSE_INFLUENCE)/3,
                0,
                Math.PI * 2
                );
            ctx.closePath();
            ctx.fill();
        } else ctx.canvas.style.cursor = 'default';

        //console.log(new Date().getTime() - time);

        if(play)
        requestAnimFrame(run);
    };
    
    var Particle = function (type, x, y) {
        this.type = type;
        this.x = x;
        this.y = y;
        this.px = x;
        this.py = y;
        this.vx = 0;
        this.vy = 0;
    };
    
    Particle.prototype.first_process = function () {
        
        var g = grid[Math.round(this.y / spacing) * num_x + Math.round(this.x / spacing)];

        if (g) g.close[g.length++] = this;

        this.vx = this.x - this.px;
        this.vy = this.y - this.py;

        if (mouse.down) {
            var dist_x = this.x - mouse.x;
            var dist_y = this.y - mouse.y;
            var dist = Math.sqrt(dist_x * dist_x + dist_y * dist_y);
            if (dist < radius * MOUSE_INFLUENCE) {
                var cos = dist_x / dist;
                var sin = dist_y / dist;
                this.vx += (MOUSE_REPEL) ? cos : -cos;
                this.vy += (MOUSE_REPEL) ? sin : -sin;
            }
        }

        this.vx += GRAVITY_X;
        this.vy += GRAVITY_Y;
        this.px = this.x;
        this.py = this.y;
        this.x += this.vx;
        this.y += this.vy;
    };
        
    Particle.prototype.second_process = function () {

        var force = 0,
            force_b = 0,
            cell_x = Math.round(this.x / spacing),
            cell_y = Math.round(this.y / spacing),
            close = [];

        for (var x_off = -1; x_off < 2; x_off++) {
            for (var y_off = -1; y_off < 2; y_off++) {
                var cell = grid[(cell_y + y_off) * num_x + (cell_x + x_off)];
                if (cell && cell.length) {
                    for (var a = 0, l = cell.length; a < l; a++) {
                        var particle = cell.close[a];
                        if (particle != this) {
                            var dfx = particle.x - this.x;
                            var dfy = particle.y - this.y;
                            var distance = Math.sqrt(dfx * dfx + dfy * dfy);
                            if (distance < spacing) {
                                var m = 1 - (distance / spacing);
                                force += Math.pow(m, 2);
                                force_b += Math.pow(m, 3) / 2;
                                particle.m = m;
                                particle.dfx = (dfx / distance) * m;
                                particle.dfy = (dfy / distance) * m;
                                close.push(particle);
                            }
                        }
                    }
                }
            }
        }

        force = (force - 3) * 0.5;

        for (var i = 0, l = close.length; i < l; i++) {

            var neighbor = close[i];

            var press = force + force_b * neighbor.m;
            if (this.type != neighbor.type) press *= 0.35;

            var dx = neighbor.dfx * press * 0.5;
            var dy = neighbor.dfy * press * 0.5;

            neighbor.x += dx;
            neighbor.y += dy;
            this.x -= dx;
            this.y -= dy;
        }

        if (this.x < limit) this.x = limit;
        else if (this.x > width - limit) this.x = width - limit;

        if (this.y < limit) this.y = limit;
        else if (this.y > height - limit) this.y = height - limit;

        this.draw();
    };
            
    Particle.prototype.draw = function () {

        var size = radius * 2;

        meta_ctx.drawImage(
        textures[this.type],
        this.x - radius,
        this.y - radius,
        size,
        size);
    };
        
    return {
    
        init: function(canvas, w, h) {

            particles = [];
            grid      = [];
            close = [];
            textures  = [];
        
            var canvas 	  = document.getElementById(canvas);
    	ctx   	      = canvas.getContext('2d');
    	canvas.height = h || window.innerHeight;
    	canvas.width  = w || window.innerWidth;
    	width         = canvas.width;
    	height        = canvas.height;

            var meta_canvas    = document.createElement("canvas");
            meta_canvas.width  = width;
            meta_canvas.height = height;
            meta_ctx           = meta_canvas.getContext("2d");

            for(var i = 0; i < GROUPS.length; i++) {

                var colour;

                if(GROUP_COLOURS[i]) {
                    colour = GROUP_COLOURS[i];
                } else {

                    colour =
                    'hsla(' + Math.round(Math.random() * 360) + ', 80%, 60%';
                }

                textures[i] = document.createElement("canvas");
                textures[i].width  = radius * 2;
                textures[i].height = radius * 2;
                var nctx = textures[i].getContext("2d");

                var grad = nctx.createRadialGradient(
                    radius,
                    radius,
                    1,
                    radius,
                    radius,
                    radius
                    );

                grad.addColorStop(0, colour + ',1)');
                grad.addColorStop(1, colour + ',0)');
                nctx.fillStyle = grad;
                nctx.beginPath();
                nctx.arc(radius, radius, radius, 0, Math.PI * 2, true);
                nctx.closePath();
                nctx.fill();
            }
            
            canvas.onmousedown = function(e) {
        mouse.down = true;
        return false;
    	};
            
    	canvas.onmouseup = function(e) {
        mouse.down = false;
        return false;
    	};

    	canvas.onmousemove = function(e) {
    var rect = canvas.getBoundingClientRect();
  mouse.x = e.clientX - rect.left;
  mouse.y = e.clientY - rect.top;
        return false;
    	};
            
            num_x = Math.round(width / spacing) + 1;
            num_y = Math.round(height / spacing) + 1;
            
            for (var i = 0; i < num_x * num_y; i++) {
                grid[i] = {
                    length: 0,
                    close: []
                }
            }
            
            for (var i = 0; i < GROUPS.length; i++ ) {
                for (var k = 0; k < GROUPS[i]; k++ ) {
                    particles.push(
                        new Particle(
                            i,
                            radius + Math.random() * (width - radius * 2),
                            radius + Math.random() * (height - radius * 2)
                            )
                        );
                }
            }

            num_particles = particles.length

            play = true;
            run();
        },

        stop: function() {
            play = false;
        }
    
    };
    
}();

fluid.init('c', 800, 376);

document.getElementById('reset').onmousedown = function() {
    fluid.stop();
    setTimeout(function(){fluid.init('c', 800, 366)}, 100);
}
</script>
<canvas id= "c"> </canvas>
<button id="reset">new colours</button>
<div id="info">
  <div id="top">
  <a id="close" href="">close</a>
  </div>
  <p>
    <br>
      - Alter particles/groups with the GROUPS variable.<br><br>
    - Customize colours with GROUP_COLOURS.<br><br>
    - Use the mouse to move the fluid.<br><br>
    - Click anywhere to make water.<br><br>
    - Use one group for a more water-like effect.<br><br>
  </p>
</div>


[/html]

+2

116

тут слетел бэк в первоначальном варианте, а я уже подумал что так форомлять плашки в шапке можно, если немного добить

Код:
[html]
<style>

.centerBox{
	display: flex;
	justify-content: center;
	align-items: center;
	height: 200px
}

.categoryWrapper{
	height: 100px;
	width: 260px;
	background: url("") no-repeat center center;
	display: flex;
	justify-content: center;
	align-items: center;
	position: relative;
}

.categoryWrapper:after{
	position: absolute;
	top:0;
	left: 0;
	right:0;
	bottom: 0;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#a29ca9+0,95909b+99 */
background: #a29ca9; /* Old browsers */
background: -moz-linear-gradient(-45deg, #a29ca9 0%, #95909b 99%); /* FF3.6-15 */
background: -webkit-linear-gradient(-45deg, #a29ca9 0%,#95909b 99%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(135deg, #a29ca9 0%,#95909b 99%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a29ca9', endColorstr='#95909b',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
	content: '';
	opacity: 0;
    -webkit-transition: opacity 0.9s ease 0s; 
}

.categoryWrapper:hover:after{
	opacity: 0.4;
background-image: url(https://i.pinimg.com/474x/d6/0f/9c/d60f9cb6fc0443a910c883705c4acb95.jpg);
background-size: cover;
}

.categoryWrapper h61{
	color: #000;
	font-size: 10px;
	letter-spacing: 2px;
	-webkit-transition: all 0.15s ease 0s; 
	position: relative;
	z-index: 10;
}

.categoryWrapper:hover h61{
	transform: translateY(-10px);
}

.categoryWrapper button{
	position: absolute;
	transform: translatey(20px);
	-webkit-appearance: none;
	border: none;
	background: none;
	color:white;
	width: 80px;
	height:25px;
	font-size: 10px;
	padding: 0;
	margin: 0;
	outline: none;
	z-index: 10;
}

.categoryWrapper button span{
	display: block;
	position: relative;
	line-height: 10px;
	height: 25px;
	cursor: pointer;
}

.categoryWrapper button > span:after{
	content:'';
	position: absolute;
	top:0;
	left: 50%;
	width: 20px;
	height: 0;
	
	border: 1px solid white;
	border-left: none;
	border-bottom: none;
	
	    transition: height 0.15s ease-out, width 0.15s ease-out 0.15s;
}

.categoryWrapper:hover button > span:after{
	width: calc(50% - 1px);
	height: calc(100% - 2px);
	transition: width 0.15s ease-out, height 0.15s ease-out 0.15s;
}

.categoryWrapper button > span:before{
	content:'';
	position: absolute;
	top:0;
	right: 50%;
	width: 20px;
	height: 0;
	
	border: 1px solid white;
	border-right: none;
	border-bottom: none;
	
	    transition: height 0.15s ease-out, width 0.15s ease-out 0.15s;
}

.categoryWrapper:hover button > span:before{
	width: calc(50% - 1px);
	height: calc(100% - 2px);
	transition: width 0.15s ease-out, height 0.15s ease-out 0.15s;
}

.categoryWrapper button > span > span:before{
	content:'';
	position: absolute;
	bottom:0;
	right: 0%;
	width: 1px;
	height: 1px;
	opacity: 0;
	
}

.categoryWrapper:hover button > span > span:before{
	opacity: 1;
	border-bottom: 1px solid white;
	width: calc(50%);
	height: 1px;
	transition: opacity 0s ease-out 0.29s, width 0.15s ease-out 0.3s;
}

.categoryWrapper button > span > span:after{
	content:'';
	position: absolute;
	bottom:0;
	left: 0%;
	width: 1px;
	height: 1px;
	opacity: 0;
	
}

.categoryWrapper:hover button > span > span:after{
	opacity: 1;
	border-bottom: 1px solid white;
	width: calc(50%);
	height: 1px;
	transition: opacity 0s ease-out 0.29s, width 0.15s ease-out 0.3s;
}

.categoryWrapper button > span > span > span{
	transition: color 0.15s ease-out 0.3s;
	color: transparent;
}

.categoryWrapper:hover button > span > span > span{
	color:white;
}

.categoryWrapper button > span > span > span:after{
	position: absolute;
	top:0;left:0;right:0;bottom:0;
	color:#1f2e4d;
	content: attr(data-attr-span);
	width: 0%;
	height: 100%;
	background:white;
	white-space: nowrap;
	text-align: center;
	margin: auto;
	overflow: hidden;
	display: flex;
	justify-content: center;
	transition: width 0.2s;
}

.categoryWrapper button:hover > span > span > span:after{
	width: 100%;
}
</style>
<!-- THIS IS GOING TO BE A MAGENTO BUTTON -->

<div class="centerBox">
	
	<div class="categoryWrapper">
    <h61>Администрация</h61>
    <button>
    	<span>
        <span>
        	<span data-attr-span="Написать">
            Великий и Ужасный
        	</span>
        </span>
    	</span>
    </button>
	</div>

	<div class="categoryWrapper">
    <h61>Администрация</h61>
    <button>
    	<span>
        <span>
        	<span data-attr-span="Написать">
            Великий и Ужасный
        	</span>
        </span>
    	</span>
    </button>
	</div>

	<div class="categoryWrapper">
    <h61>Администрация</h61>
    <button>
    	<span>
        <span>
        	<span data-attr-span="Написать">
            Великий и Ужасный
        	</span>
        </span>
    	</span>
    </button>
	</div>

	<div class="categoryWrapper">
    <h61>Администрация</h61>
    <button>
    	<span>
        <span>
        	<span data-attr-span="Написать">
            Великий и Ужасный
        	</span>
        </span>
    	</span>
    </button>
	</div>
	
</div>

[/html]

+2

117

Will O The Wisp
ТЕМА супер  :cool:

+4

118

это кнопочка с рамочкой и вообще пример как добавлять шаблонные кнопки в область ответа

Код:
<!--Шаблон-->
<style>
#button-template {background-image:url('https://i.ibb.co/Bzgr2Y7/DMZAKUH.jpg'); padding:0; line-height:0; background-position:center; background-size:70%; background-repeat:no-repeat;}
.post-content img[alt="imgBorder"] {
    background: url(http://www.lenagold.ru/fon/pred/bum/map/map01.jpg) repeat;
    padding: 10px 10px 10px 10px;
    width: 90%;
}
</style>
<script type="text/javascript">
if(form=document.getElementById("form-buttons"))
form.getElementsByTagName("tr")[0].insertCell(18).innerHTML="<a href='javascript:void(0);'onclick=\"addTemplate()\"><img src='/i/blank.gif' title='Рамочка вокруг картинки' id='button-template' /></a>"
</script>
<script>
function addTemplate (){document.getElementById('main-reply').value +='[img=imgBorder]Прямая ссылка на картинку[/img] '};
</script>

+4

119

скрипт
падающие буквы

Код:
[html]
<style>
span{
  -webkit-transition:all 10s ease-in;
  transition:all 10s ease-in;
  display:inline-block;
}
.fallen{
  -webkit-transform:translate(0,200px);
  transform:translate(0,200px);
}
p4{
 margin:3em 5em;
  font-family:Georgia,serif;
  font-size:large;
  color:#000 ;
  
}

</style>
<script>
var p = $('p4');
p.each(function(){
    var t = $(this).text().replace(/\s/g, unescape('%a0')); /* Spaces collapse, so make them non-breaking */
    var o = '';
    for(var i = 0; i< t.length; i++){
        o += '<span class="normal">' + t[i] + '</span>';
    }
    $(this).html(o);
});

function lift(){
	$('.fallen').removeClass('fallen').addClass('normal');
	window.setTimeout(drop, 60);
}

function drop(){
  var s = $('span.normal');
  if (s.length == 0){
   window.setTimeout(lift, 10000);
   return;
  }
  
  s.eq(Math.floor(Math.random() *   s.length)).addClass('fallen').removeClass('normal');
	window.setTimeout(drop, 60);
}

drop();

</script>
<container style="height: 500px;display: block;"><p4>В другой день Крони взбесился бы от такой неудачи, но сегодня было иначе. Он дождался грузового лифта и поклонился стражнику. Стражник отвернулся. Здороваться с трубарем он не хотел. Но знал его уже лет шесть и не обижал. Лифт пошел вниз. Крони ехал раньше, чем обычно, и потому в лифте оказались не те, с кем он ездил всегда. Крони вдруг подумал, что в своей жизни он встречал очень немного людей. Одних и тех же. С кем работает, с кем ездит и кое-кого из соседей. Некоторых еще не видел, о некоторых только слышал. А еще есть люди, которых трудно считать людьми, потому что они подобны наводнению или обвалу. Это сборщик или те, кто приходит с месячным обыском. Или человек от ростовщика. Крони знал, что почти все на уровне живут так же. Только у старухи меньше знакомых, а у господина Ратни больше.</p4></container>

[/html]

+3

120

+1