- removed js 3rd party dependency plugin "GSAP easepack",
- removed js 3rd party dependency plugin "GSAP tweenLite"
This commit is contained in:
@@ -60,10 +60,6 @@ requirejs.config({
|
||||
'summernote.loader': './app/summernote.loader', // v0.8.10 Summernote WYSIWYG editor -https://summernote.org
|
||||
'summernote': 'lib/summernote/summernote.min',
|
||||
|
||||
// header animation
|
||||
easePack: 'lib/EasePack.min',
|
||||
tweenLite: 'lib/TweenLite.min',
|
||||
|
||||
// DataTables // v1.10.18 DataTables - https://datatables.net
|
||||
'datatables.loader': './app/datatables.loader',
|
||||
'datatables.net': 'lib/datatables/DataTables-1.10.18/js/jquery.dataTables.min',
|
||||
|
||||
@@ -8,9 +8,9 @@ define([
|
||||
'app/util',
|
||||
'app/render',
|
||||
'blueImpGallery',
|
||||
'layout/header_login',
|
||||
'bootbox',
|
||||
'lazyload',
|
||||
'layout/header_login',
|
||||
'layout/logo',
|
||||
'layout/demo_map',
|
||||
'dialog/account_settings',
|
||||
@@ -18,8 +18,8 @@ define([
|
||||
'dialog/manual',
|
||||
'dialog/changelog',
|
||||
'dialog/credit',
|
||||
'dialog/api_status',
|
||||
], ($, Init, Util, Render, Gallery, bootbox) => {
|
||||
'dialog/api_status'
|
||||
], ($, Init, Util, Render, Gallery, HeaderLogin, bootbox) => {
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -850,9 +850,7 @@ define([
|
||||
// draw header logo
|
||||
$('#' + config.logoContainerId).drawLogo(() => {
|
||||
// init header animation
|
||||
$('#' + config.headerContainerId).initHeader(() => {
|
||||
|
||||
});
|
||||
HeaderLogin.init(document.getElementById(config.headerContainerId));
|
||||
}, false);
|
||||
|
||||
});
|
||||
|
||||
@@ -3,237 +3,425 @@
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'easePack',
|
||||
'tweenLite'
|
||||
'jquery'
|
||||
], ($) => {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
previewElementClass: 'pf-header-preview-element' // class for "preview" elements
|
||||
headerId: 'pf-landing-top', // id for page header
|
||||
canvasId: 'pf-header-canvas', // id for canvas background
|
||||
previewElementClass: 'pf-header-preview-element' // class for "preview" elements
|
||||
};
|
||||
|
||||
class Color {
|
||||
constructor(r, g, b, a = 1){
|
||||
this._r = r;
|
||||
this._g = g;
|
||||
this._b = b;
|
||||
this._a = a;
|
||||
}
|
||||
|
||||
let width, height, largeHeader, canvas, ctx, points, target, animateHeader = true;
|
||||
get r(){
|
||||
return this._r;
|
||||
}
|
||||
|
||||
let canvasHeight = 355;
|
||||
let colorRGB = '108, 174, 173';
|
||||
let connectionCount = 4;
|
||||
get g(){
|
||||
return this._g;
|
||||
}
|
||||
|
||||
get b(){
|
||||
return this._b;
|
||||
}
|
||||
|
||||
let initHeader = function(){
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
target = {x: width * 1, y: 230};
|
||||
style(a = this.a){
|
||||
return `rgba(${this.r}, ${this.g}, ${this.b}, ${a})`;
|
||||
}
|
||||
}
|
||||
|
||||
largeHeader.style.height = height+'px';
|
||||
class Node {
|
||||
constructor(x, y, ctx, config = {}){
|
||||
this._anchorX = x;
|
||||
this._anchorY = y;
|
||||
this._ctx = ctx;
|
||||
this._config = config;
|
||||
this._x = Math.random() * (x - (x - this._config.anchorLength)) + (x - this._config.anchorLength);
|
||||
this._y = Math.random() * (y - (y - this._config.anchorLength)) + (y - this._config.anchorLength);
|
||||
this._vx = Math.random() * 2 - 1;
|
||||
this._vy = Math.random() * 2 - 1;
|
||||
this._energy = Math.random() * 100;
|
||||
this._radius = Math.random();
|
||||
this._siblings = [];
|
||||
this._brightness = 0;
|
||||
this._isPointer = false;
|
||||
}
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
ctx = canvas.getContext('2d');
|
||||
set x(x){
|
||||
this._x = x;
|
||||
}
|
||||
|
||||
// create points
|
||||
points = [];
|
||||
for(let x = 0; x < width; x = x + width/20){
|
||||
for(let y = 0; y < height; y = y + height/15){
|
||||
let px = x + Math.random()*width/15;
|
||||
let py = y + Math.random()*height/15;
|
||||
let p = {x: px, originX: px, y: py, originY: py };
|
||||
points.push(p);
|
||||
get x(){
|
||||
return this._x;
|
||||
}
|
||||
|
||||
set y(y){
|
||||
this._y = y;
|
||||
}
|
||||
|
||||
get y(){
|
||||
return this._y;
|
||||
}
|
||||
|
||||
set siblings(siblings){
|
||||
this._siblings = siblings;
|
||||
}
|
||||
|
||||
get siblings(){
|
||||
return this._siblings;
|
||||
}
|
||||
|
||||
get radius(){
|
||||
if(this.isPointer){
|
||||
return 3;
|
||||
}
|
||||
return 2 * this._radius + 2 * this._siblings.length / this._config.siblingsLimit;
|
||||
}
|
||||
|
||||
// for each point find the 5 closest points
|
||||
for(let i = 0; i < points.length; i++){
|
||||
let closest = [];
|
||||
let p1 = points[i];
|
||||
for(let j = 0; j < points.length; j++){
|
||||
let p2 = points[j];
|
||||
if(p1 !== p2){
|
||||
let placed = false;
|
||||
for(let k = 0; k < connectionCount; k++){
|
||||
if(!placed){
|
||||
if(closest[k] === undefined){
|
||||
closest[k] = p2;
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let m = 0; m < connectionCount; m++){
|
||||
if(!placed){
|
||||
if(getDistance(p1, p2) < getDistance(p1, closest[m])){
|
||||
closest[m] = p2;
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
p1.closest = closest;
|
||||
set brightness(brightness){
|
||||
this._brightness = brightness;
|
||||
}
|
||||
|
||||
// assign a circle to each point
|
||||
for(let n in points){
|
||||
let c = new Circle(points[n], 2+Math.random()*2, 'rgba(255,255,255,0.3)');
|
||||
points[n].circle = c;
|
||||
get brightness(){
|
||||
return this.isPointer ? 1 : this._brightness;
|
||||
}
|
||||
};
|
||||
|
||||
// Event handling
|
||||
let addListeners = function(){
|
||||
if(!('ontouchstart' in window)){
|
||||
window.addEventListener('mousemove', mouseMove);
|
||||
set color(color){
|
||||
this._color = color;
|
||||
}
|
||||
window.addEventListener('scroll', scrollCheck);
|
||||
window.addEventListener('resize', resize);
|
||||
};
|
||||
|
||||
let mouseMove = function(e){
|
||||
let posx = 0;
|
||||
let posy = 0;
|
||||
if(e.pageX || e.pageY){
|
||||
posx = e.pageX;
|
||||
posy = e.pageY;
|
||||
}else if(e.clientX || e.clientY){
|
||||
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
|
||||
get color(){
|
||||
return this._color;
|
||||
}
|
||||
target.x = posx;
|
||||
target.y = posy;
|
||||
};
|
||||
|
||||
let scrollCheck = function(){
|
||||
if(document.body.scrollTop > height){
|
||||
animateHeader = false;
|
||||
}else{
|
||||
animateHeader = true;
|
||||
set isPointer(isPointer){
|
||||
this._isPointer = isPointer;
|
||||
}
|
||||
};
|
||||
|
||||
let resize = function(){
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
largeHeader.style.height = height+'px';
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
};
|
||||
|
||||
// animation
|
||||
let initAnimation = function(){
|
||||
animate();
|
||||
for(let i in points){
|
||||
shiftPoint(points[i]);
|
||||
get isPointer(){
|
||||
return this._isPointer;
|
||||
}
|
||||
};
|
||||
|
||||
let animate = function animate(){
|
||||
if(animateHeader){
|
||||
ctx.clearRect(0,0,width,height);
|
||||
for(let i in points){
|
||||
// detect points in range
|
||||
if(Math.abs(getDistance(target, points[i])) < 4000){
|
||||
points[i].active = 0.25;
|
||||
points[i].circle.active = 0.45;
|
||||
}else if(Math.abs(getDistance(target, points[i])) < 20000){
|
||||
points[i].active = 0.1;
|
||||
points[i].circle.active = 0.3;
|
||||
}else if(Math.abs(getDistance(target, points[i])) < 40000){
|
||||
points[i].active = 0.02;
|
||||
points[i].circle.active = 0.1;
|
||||
drawNode(){
|
||||
this._ctx.beginPath();
|
||||
this._ctx.arc(this.x, this.y, this.radius, 0, StarCanvas.circ);
|
||||
this._ctx.fillStyle = this.color.style(this.brightness * this._config.brightnessMultiplierNode);
|
||||
this._ctx.fill();
|
||||
}
|
||||
|
||||
drawConnections(){
|
||||
for(let i = 0; i < this._siblings.length; i++){
|
||||
this._ctx.beginPath();
|
||||
this._ctx.moveTo(this.x, this.y);
|
||||
this._ctx.lineTo(this._siblings[i].x, this._siblings[i].y);
|
||||
this._ctx.lineWidth = 1 - StarCanvas.calcDistance(this, this._siblings[i]) / this._config.sensitivity;
|
||||
if(this.color === this._siblings[i].color){
|
||||
// no gradient
|
||||
this._ctx.strokeStyle = this.color.style(this.brightness * this._config.brightnessMultiplierConnection);
|
||||
}else{
|
||||
points[i].active = 0;
|
||||
points[i].circle.active = 0;
|
||||
// gradient
|
||||
this._ctx.strokeStyle = this.gradient(this._siblings[i], StarCanvas.lineStyle(this, this._siblings[i])) ;
|
||||
}
|
||||
|
||||
drawLines(points[i]);
|
||||
points[i].circle.draw();
|
||||
this._ctx.stroke();
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(animate);
|
||||
};
|
||||
|
||||
let shiftPoint = function(p){
|
||||
TweenLite.to(p, 1 + 1 * Math.random(), {x: p.originX - 50 + Math.random() * 100,
|
||||
y: p.originY - 50 + Math.random() * 100, ease: Circ.easeInOut,
|
||||
onComplete: function(){
|
||||
shiftPoint(p);
|
||||
}});
|
||||
};
|
||||
|
||||
// Canvas manipulation
|
||||
let drawLines = function(p){
|
||||
if(!p.active) return;
|
||||
for(let i in p.closest){
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(p.x, p.y);
|
||||
ctx.lineTo(p.closest[i].x, p.closest[i].y);
|
||||
ctx.strokeStyle = 'rgba(' + colorRGB +','+ p.active+')';
|
||||
ctx.stroke();
|
||||
gradient(node2, midColor){
|
||||
let grad = this._ctx.createLinearGradient(Math.floor(this.x), Math.floor(this.y), Math.floor(node2.x), Math.floor(node2.y));
|
||||
grad.addColorStop(0, this.color.style(this.brightness * this._config.brightnessMultiplierConnection));
|
||||
grad.addColorStop(0.5, midColor);
|
||||
grad.addColorStop(1, node2.color.style(node2.brightness * this._config.brightnessMultiplierConnection));
|
||||
return grad;
|
||||
}
|
||||
|
||||
moveNode(){
|
||||
this._energy -= 2;
|
||||
if(this._energy < 1){
|
||||
this._energy = Math.random() * 100;
|
||||
if(this.x - this._anchorX < -this._config.anchorLength){
|
||||
this._vx = Math.random() * 2;
|
||||
}else if(this.x - this._anchorX > this._config.anchorLength){
|
||||
this._vx = Math.random() * -2;
|
||||
}else{
|
||||
this._vx = Math.random() * 4 - 2;
|
||||
}
|
||||
if(this.y - this._anchorY < -this._config.anchorLength){
|
||||
this._vy = Math.random() * 2;
|
||||
}else if (this.y - this._anchorY > this._config.anchorLength){
|
||||
this._vy = Math.random() * -2;
|
||||
}else{
|
||||
this._vy = Math.random() * 4 - 2;
|
||||
}
|
||||
}
|
||||
this.x += this._vx * this._energy / 100;
|
||||
this.y += this._vy * this._energy / 100;
|
||||
}
|
||||
}
|
||||
|
||||
class StarCanvas {
|
||||
constructor(canvas, config = {}) {
|
||||
this._canvas = canvas;
|
||||
this._config = Object.assign({}, new.target.defaultConfig, config);
|
||||
this._nodes = [];
|
||||
this._nodesQty = 0;
|
||||
this._updateActive = true;
|
||||
|
||||
this.resizeWindow();
|
||||
this._mouse = this._config.startCoordinates(this._canvas);
|
||||
|
||||
this._ctx = this._canvas.getContext('2d');
|
||||
this.initHandlers();
|
||||
this.initIntersectionObserver();
|
||||
this.initNodes();
|
||||
this.redrawCheck();
|
||||
}
|
||||
|
||||
findSiblings(){
|
||||
let node1, node2, distance;
|
||||
for(let i = 0; i < this._nodesQty; i++){
|
||||
node1 = this._nodes[i];
|
||||
node1.siblings = [];
|
||||
for(let j = 0; j < this._nodesQty; j++){
|
||||
node2 = this._nodes[j];
|
||||
if(node1 !== node2){
|
||||
distance = StarCanvas.calcDistance(node1, node2);
|
||||
if(distance < this._config.sensitivity){
|
||||
if(node1.siblings.length < this._config.siblingsLimit){
|
||||
node1.siblings.push(node2);
|
||||
}else{
|
||||
let node_sibling_distance = 0;
|
||||
let max_distance = 0;
|
||||
let s;
|
||||
for(let k = 0; k < this._config.siblingsLimit; k++){
|
||||
node_sibling_distance = StarCanvas.calcDistance(node1, node1.siblings[k]);
|
||||
if(node_sibling_distance > max_distance){
|
||||
max_distance = node_sibling_distance;
|
||||
s = k;
|
||||
}
|
||||
}
|
||||
if(distance < max_distance){
|
||||
node1.siblings.splice(s, 1);
|
||||
node1.siblings.push(node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redrawScene(){
|
||||
this.resizeWindow();
|
||||
this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||
this.findSiblings();
|
||||
// skip nodes move to move if they are outside the visible radius -> performance boost
|
||||
let haltRadius = this._config.mouseRadius + this._config.anchorLength;
|
||||
// mouse pointer node moves on mousemove
|
||||
this._pointerNode.x = this._mouse.x;
|
||||
this._pointerNode.y = this._mouse.y;
|
||||
let skipNodesMove = [this._pointerNode];
|
||||
|
||||
let i, node, distance;
|
||||
for(i = 0; i < this._nodesQty; i++){
|
||||
node = this._nodes[i];
|
||||
distance = StarCanvas.calcDistance({
|
||||
x: this._mouse.x,
|
||||
y: this._mouse.y
|
||||
}, node);
|
||||
|
||||
if(distance < this._config.mouseRadius){
|
||||
node.brightness = 1 - distance / this._config.mouseRadius;
|
||||
}else{
|
||||
node.brightness = 0;
|
||||
}
|
||||
|
||||
if(distance > haltRadius){
|
||||
skipNodesMove.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < this._nodesQty; i++){
|
||||
node = this._nodes[i];
|
||||
if(node.brightness){
|
||||
node.drawNode();
|
||||
node.drawConnections();
|
||||
}
|
||||
|
||||
if(!skipNodesMove.includes(node)){
|
||||
node.moveNode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redrawCheck(){
|
||||
if(this._updateActive){
|
||||
this.redrawScene();
|
||||
}
|
||||
requestAnimationFrame(() => this.redrawCheck());
|
||||
}
|
||||
|
||||
initNodes(){
|
||||
this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||
this._nodes = [];
|
||||
for(let i = this._config.density; i < this._canvas.width; i += this._config.density) {
|
||||
for(let j = this._config.density; j < this._canvas.height; j += this._config.density) {
|
||||
let node = new Node(i, j, this._ctx, this._config);
|
||||
if(typeof this._config.colorBase === 'function'){
|
||||
node.color = this._config.colorBase(node, this);
|
||||
}else{
|
||||
node.color = new Color(...this._config.colorBase);
|
||||
}
|
||||
this._nodes.push(node);
|
||||
this._nodesQty++;
|
||||
}
|
||||
}
|
||||
|
||||
// mouse cursor node
|
||||
this._pointerNode = new Node(
|
||||
this._mouse.x,
|
||||
this._mouse.y,
|
||||
this._ctx,
|
||||
this._config
|
||||
);
|
||||
this._pointerNode.color = new Color(...this._config.colorCursor);
|
||||
this._pointerNode.brightness = 1;
|
||||
this._pointerNode.isPointer = true;
|
||||
this._nodes.unshift(this._pointerNode);
|
||||
this._nodesQty++;
|
||||
}
|
||||
|
||||
initHandlers(){
|
||||
document.addEventListener('resize', () => this.resizeWindow(), false);
|
||||
document.addEventListener('mousemove', e => this.mousemoveHandler(e), true);
|
||||
}
|
||||
|
||||
initIntersectionObserver(){
|
||||
let intersectionCallback = entries => {
|
||||
let visiblePct = Math.floor(entries[0].intersectionRatio * 100);
|
||||
this._updateActive = visiblePct > 0;
|
||||
};
|
||||
|
||||
this._intersectionObserver = new IntersectionObserver(intersectionCallback, {
|
||||
threshold: [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
|
||||
});
|
||||
this._intersectionObserver.observe(this._canvas);
|
||||
}
|
||||
|
||||
mousemoveHandler(e){
|
||||
this._mouse.x = e.clientX;
|
||||
this._mouse.y = e.clientY;
|
||||
}
|
||||
|
||||
resizeWindow(){
|
||||
let dimension = this._config.newDimension(this);
|
||||
this._canvas.width = dimension.width;
|
||||
this._canvas.height = dimension.height;
|
||||
}
|
||||
}
|
||||
|
||||
StarCanvas.circ = 2 * Math.PI;
|
||||
StarCanvas.calcDistance = (node1, node2) => {
|
||||
return Math.sqrt(Math.pow(node1.x - node2.x, 2) + (Math.pow(node1.y - node2.y, 2)));
|
||||
};
|
||||
|
||||
let Circle = function(pos,rad,color){
|
||||
let _this = this;
|
||||
|
||||
// constructor
|
||||
(function(){
|
||||
_this.pos = pos || null;
|
||||
_this.radius = rad || null;
|
||||
_this.color = color || null;
|
||||
})();
|
||||
|
||||
this.draw = function(){
|
||||
if(!_this.active) return;
|
||||
ctx.beginPath();
|
||||
ctx.arc(_this.pos.x, _this.pos.y, _this.radius, 0, 2 * Math.PI, false);
|
||||
ctx.fillStyle = 'rgba(' + colorRGB + ','+ _this.active+')';
|
||||
ctx.fill();
|
||||
};
|
||||
StarCanvas.lineStyle = (node1, node2) => {
|
||||
let r = StarCanvas.mixComponents(node1.color.r, node2.color.r, node1.radius, node2.radius);
|
||||
let g = StarCanvas.mixComponents(node1.color.g, node2.color.g, node1.radius, node2.radius);
|
||||
let b = StarCanvas.mixComponents(node1.color.b, node2.color.b, node1.radius, node2.radius);
|
||||
let a = (node1.brightness + node2.brightness) / 2;
|
||||
return `rgba(${Math.floor(r)}, ${Math.floor(g)}, ${Math.floor(b)}, ${a})`;
|
||||
};
|
||||
|
||||
// Util
|
||||
let getDistance = function(p1, p2){
|
||||
return Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2);
|
||||
StarCanvas.mixComponents = (comp1, comp2, weight1, weight2) => {
|
||||
return (comp1*weight1 + comp2*weight2) / (weight1 + weight2);
|
||||
};
|
||||
|
||||
/**
|
||||
* init header animation
|
||||
* @param callback
|
||||
*/
|
||||
$.fn.initHeader = function(callback){
|
||||
largeHeader = $(this)[0];
|
||||
canvas = $(this).find('canvas:visible')[0];
|
||||
StarCanvas.getRandomIntInclusive = (min, max) => {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min +1)) + min;
|
||||
};
|
||||
|
||||
// header preview elements
|
||||
$('.' + config.previewElementClass).velocity('transition.bounceIn', {
|
||||
|
||||
StarCanvas.defaultConfig = {
|
||||
// how close next node must be to activate connection (in px)
|
||||
// shorter distance == better connection (line width)
|
||||
sensitivity: 90,
|
||||
// note that siblings limit is not 'accurate' as the node can actually have more connections than this value
|
||||
// that's because the node accepts sibling nodes with no regard to their current connections this is acceptable
|
||||
// because potential fix would not result in significant visual difference
|
||||
// more siblings == bigger node
|
||||
siblingsLimit: 30,
|
||||
// default node margin
|
||||
density: 50,
|
||||
// avoid nodes spreading
|
||||
anchorLength: 120,
|
||||
// highlight radius
|
||||
mouseRadius: 200,
|
||||
// values < 1 will lower the calculated node brightness [0-1]
|
||||
brightnessMultiplierNode: 1,
|
||||
// values < 1 will lower the calculated connection brightness [0-1]
|
||||
brightnessMultiplierConnection: 1,
|
||||
colorBase: [108, 174, 173], // teal
|
||||
colorCursor: [226, 138, 13], // orange
|
||||
// callback for canvas dimension re-calc
|
||||
newDimension: () => ({width: window.innerWidth, height: window.innerHeight}),
|
||||
// start coordinates (before mouse move)
|
||||
startCoordinates: canvas => ({
|
||||
x: canvas.width / 2,
|
||||
y: canvas.height / 2
|
||||
})
|
||||
};
|
||||
|
||||
let init = headerEl => {
|
||||
let previewEls = headerEl.getElementsByClassName(config.previewElementClass);
|
||||
|
||||
$(previewEls).velocity('transition.bounceIn', {
|
||||
duration: 600,
|
||||
stagger: 60,
|
||||
delay: 120,
|
||||
complete: function(){
|
||||
|
||||
// show header canvas animation
|
||||
let canvas = document.getElementById(config.canvasId);
|
||||
// not on mobile
|
||||
if(canvas){
|
||||
// header animation
|
||||
initHeader();
|
||||
initAnimation();
|
||||
addListeners();
|
||||
|
||||
$(canvas).velocity('fadeIn', {
|
||||
duration: 900,
|
||||
visibility: 'visible',
|
||||
complete: function(){
|
||||
if(callback !== undefined){
|
||||
callback();
|
||||
new StarCanvas(canvas, {
|
||||
brightnessMultiplierConnection: 0.9,
|
||||
colorBase: (starCanvas, node) => {
|
||||
let rgb = StarCanvas.defaultConfig.colorBase;
|
||||
switch(StarCanvas.getRandomIntInclusive(0, 4)){
|
||||
case 1: rgb = [ 92, 184, 92]; break; // green
|
||||
case 2: rgb = [ 68, 170, 130]; break; // aqua
|
||||
case 3: rgb = [194, 118, 12]; break; // orange dark
|
||||
case 4: rgb = StarCanvas.defaultConfig.colorBase; break;
|
||||
}
|
||||
}
|
||||
return new Color(...rgb);
|
||||
},
|
||||
colorCursor: [200, 184, 71], // red dark
|
||||
newDimension: starCanvas => ({
|
||||
width: window.innerWidth,
|
||||
height: starCanvas._canvas.closest(`#${config.headerId}`).getBoundingClientRect().height - 1 // border
|
||||
}),
|
||||
startCoordinates: canvas => ({
|
||||
x: canvas.width / 2 + 500,
|
||||
y: canvas.height / 2 + 50
|
||||
})
|
||||
});
|
||||
|
||||
canvas.classList.add('in');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
return {
|
||||
init
|
||||
};
|
||||
});
|
||||
12
js/lib/EasePack.min.js
vendored
12
js/lib/EasePack.min.js
vendored
@@ -1,12 +0,0 @@
|
||||
/*!
|
||||
* VERSION: beta 1.9.4
|
||||
* DATE: 2014-07-17
|
||||
* UPDATES AND DOCS AT: http://www.greensock.com
|
||||
*
|
||||
* @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
|
||||
* This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
|
||||
* Club GreenSock members, the software agreement that was issued with your membership.
|
||||
*
|
||||
* @author: Jack Doyle, jack@greensock.com
|
||||
**/
|
||||
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.Back",["easing.Ease"],function(t){var e,i,s,r=_gsScope.GreenSockGlobals||_gsScope,n=r.com.greensock,a=2*Math.PI,o=Math.PI/2,h=n._class,l=function(e,i){var s=h("easing."+e,function(){},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,s},_=t.register||function(){},u=function(t,e,i,s){var r=h("easing."+t,{easeOut:new e,easeIn:new i,easeInOut:new s},!0);return _(r,t),r},c=function(t,e,i){this.t=t,this.v=e,i&&(this.next=i,i.prev=this,this.c=i.v-e,this.gap=i.t-t)},p=function(e,i){var s=h("easing."+e,function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,r.config=function(t){return new s(t)},s},f=u("Back",p("BackOut",function(t){return(t-=1)*t*((this._p1+1)*t+this._p1)+1}),p("BackIn",function(t){return t*t*((this._p1+1)*t-this._p1)}),p("BackInOut",function(t){return 1>(t*=2)?.5*t*t*((this._p2+1)*t-this._p2):.5*((t-=2)*t*((this._p2+1)*t+this._p2)+2)})),m=h("easing.SlowMo",function(t,e,i){e=e||0===e?e:.7,null==t?t=.7:t>1&&(t=1),this._p=1!==t?e:0,this._p1=(1-t)/2,this._p2=t,this._p3=this._p1+this._p2,this._calcEnd=i===!0},!0),d=m.prototype=new t;return d.constructor=m,d.getRatio=function(t){var e=t+(.5-t)*this._p;return this._p1>t?this._calcEnd?1-(t=1-t/this._p1)*t:e-(t=1-t/this._p1)*t*t*t*e:t>this._p3?this._calcEnd?1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},m.ease=new m(.7,.7),d.config=m.config=function(t,e,i){return new m(t,e,i)},e=h("easing.SteppedEase",function(t){t=t||1,this._p1=1/t,this._p2=t+1},!0),d=e.prototype=new t,d.constructor=e,d.getRatio=function(t){return 0>t?t=0:t>=1&&(t=.999999999),(this._p2*t>>0)*this._p1},d.config=e.config=function(t){return new e(t)},i=h("easing.RoughEase",function(e){e=e||{};for(var i,s,r,n,a,o,h=e.taper||"none",l=[],_=0,u=0|(e.points||20),p=u,f=e.randomize!==!1,m=e.clamp===!0,d=e.template instanceof t?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;--p>-1;)i=f?Math.random():1/u*p,s=d?d.getRatio(i):i,"none"===h?r=g:"out"===h?(n=1-i,r=n*n*g):"in"===h?r=i*i*g:.5>i?(n=2*i,r=.5*n*n*g):(n=2*(1-i),r=.5*n*n*g),f?s+=Math.random()*r-.5*r:p%2?s+=.5*r:s-=.5*r,m&&(s>1?s=1:0>s&&(s=0)),l[_++]={x:i,y:s};for(l.sort(function(t,e){return t.x-e.x}),o=new c(1,1,null),p=u;--p>-1;)a=l[p],o=new c(a.x,a.y,o);this._prev=new c(0,0,0!==o.t?o:o.next)},!0),d=i.prototype=new t,d.constructor=i,d.getRatio=function(t){var e=this._prev;if(t>e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&e.t>=t;)e=e.prev;return this._prev=e,e.v+(t-e.t)/e.gap*e.c},d.config=function(t){return new i(t)},i.ease=new i,u("Bounce",l("BounceOut",function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}),l("BounceIn",function(t){return 1/2.75>(t=1-t)?1-7.5625*t*t:2/2.75>t?1-(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}),l("BounceInOut",function(t){var e=.5>t;return t=e?1-2*t:2*t-1,t=1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5})),u("Circ",l("CircOut",function(t){return Math.sqrt(1-(t-=1)*t)}),l("CircIn",function(t){return-(Math.sqrt(1-t*t)-1)}),l("CircInOut",function(t){return 1>(t*=2)?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)})),s=function(e,i,s){var r=h("easing."+e,function(t,e){this._p1=t||1,this._p2=e||s,this._p3=this._p2/a*(Math.asin(1/this._p1)||0)},!0),n=r.prototype=new t;return n.constructor=r,n.getRatio=i,n.config=function(t,e){return new r(t,e)},r},u("Elastic",s("ElasticOut",function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*a/this._p2)+1},.3),s("ElasticIn",function(t){return-(this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2))},.3),s("ElasticInOut",function(t){return 1>(t*=2)?-.5*this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2):.5*this._p1*Math.pow(2,-10*(t-=1))*Math.sin((t-this._p3)*a/this._p2)+1},.45)),u("Expo",l("ExpoOut",function(t){return 1-Math.pow(2,-10*t)}),l("ExpoIn",function(t){return Math.pow(2,10*(t-1))-.001}),l("ExpoInOut",function(t){return 1>(t*=2)?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))})),u("Sine",l("SineOut",function(t){return Math.sin(t*o)}),l("SineIn",function(t){return-Math.cos(t*o)+1}),l("SineInOut",function(t){return-.5*(Math.cos(Math.PI*t)-1)})),h("easing.EaseLookup",{find:function(e){return t.map[e]}},!0),_(r.SlowMo,"SlowMo","ease,"),_(i,"RoughEase","ease,"),_(e,"SteppedEase","ease,"),f},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();
|
||||
12
js/lib/TweenLite.min.js
vendored
12
js/lib/TweenLite.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -60,10 +60,6 @@ requirejs.config({
|
||||
'summernote.loader': './app/summernote.loader', // v0.8.10 Summernote WYSIWYG editor -https://summernote.org
|
||||
'summernote': 'lib/summernote/summernote.min',
|
||||
|
||||
// header animation
|
||||
easePack: 'lib/EasePack.min',
|
||||
tweenLite: 'lib/TweenLite.min',
|
||||
|
||||
// DataTables // v1.10.18 DataTables - https://datatables.net
|
||||
'datatables.loader': './app/datatables.loader',
|
||||
'datatables.net': 'lib/datatables/DataTables-1.10.18/js/jquery.dataTables.min',
|
||||
|
||||
@@ -8,9 +8,9 @@ define([
|
||||
'app/util',
|
||||
'app/render',
|
||||
'blueImpGallery',
|
||||
'layout/header_login',
|
||||
'bootbox',
|
||||
'lazyload',
|
||||
'layout/header_login',
|
||||
'layout/logo',
|
||||
'layout/demo_map',
|
||||
'dialog/account_settings',
|
||||
@@ -18,8 +18,8 @@ define([
|
||||
'dialog/manual',
|
||||
'dialog/changelog',
|
||||
'dialog/credit',
|
||||
'dialog/api_status',
|
||||
], ($, Init, Util, Render, Gallery, bootbox) => {
|
||||
'dialog/api_status'
|
||||
], ($, Init, Util, Render, Gallery, HeaderLogin, bootbox) => {
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -850,9 +850,7 @@ define([
|
||||
// draw header logo
|
||||
$('#' + config.logoContainerId).drawLogo(() => {
|
||||
// init header animation
|
||||
$('#' + config.headerContainerId).initHeader(() => {
|
||||
|
||||
});
|
||||
HeaderLogin.init(document.getElementById(config.headerContainerId));
|
||||
}, false);
|
||||
|
||||
});
|
||||
|
||||
@@ -3,237 +3,425 @@
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'easePack',
|
||||
'tweenLite'
|
||||
'jquery'
|
||||
], ($) => {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
previewElementClass: 'pf-header-preview-element' // class for "preview" elements
|
||||
headerId: 'pf-landing-top', // id for page header
|
||||
canvasId: 'pf-header-canvas', // id for canvas background
|
||||
previewElementClass: 'pf-header-preview-element' // class for "preview" elements
|
||||
};
|
||||
|
||||
class Color {
|
||||
constructor(r, g, b, a = 1){
|
||||
this._r = r;
|
||||
this._g = g;
|
||||
this._b = b;
|
||||
this._a = a;
|
||||
}
|
||||
|
||||
let width, height, largeHeader, canvas, ctx, points, target, animateHeader = true;
|
||||
get r(){
|
||||
return this._r;
|
||||
}
|
||||
|
||||
let canvasHeight = 355;
|
||||
let colorRGB = '108, 174, 173';
|
||||
let connectionCount = 4;
|
||||
get g(){
|
||||
return this._g;
|
||||
}
|
||||
|
||||
get b(){
|
||||
return this._b;
|
||||
}
|
||||
|
||||
let initHeader = function(){
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
target = {x: width * 1, y: 230};
|
||||
style(a = this.a){
|
||||
return `rgba(${this.r}, ${this.g}, ${this.b}, ${a})`;
|
||||
}
|
||||
}
|
||||
|
||||
largeHeader.style.height = height+'px';
|
||||
class Node {
|
||||
constructor(x, y, ctx, config = {}){
|
||||
this._anchorX = x;
|
||||
this._anchorY = y;
|
||||
this._ctx = ctx;
|
||||
this._config = config;
|
||||
this._x = Math.random() * (x - (x - this._config.anchorLength)) + (x - this._config.anchorLength);
|
||||
this._y = Math.random() * (y - (y - this._config.anchorLength)) + (y - this._config.anchorLength);
|
||||
this._vx = Math.random() * 2 - 1;
|
||||
this._vy = Math.random() * 2 - 1;
|
||||
this._energy = Math.random() * 100;
|
||||
this._radius = Math.random();
|
||||
this._siblings = [];
|
||||
this._brightness = 0;
|
||||
this._isPointer = false;
|
||||
}
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
ctx = canvas.getContext('2d');
|
||||
set x(x){
|
||||
this._x = x;
|
||||
}
|
||||
|
||||
// create points
|
||||
points = [];
|
||||
for(let x = 0; x < width; x = x + width/20){
|
||||
for(let y = 0; y < height; y = y + height/15){
|
||||
let px = x + Math.random()*width/15;
|
||||
let py = y + Math.random()*height/15;
|
||||
let p = {x: px, originX: px, y: py, originY: py };
|
||||
points.push(p);
|
||||
get x(){
|
||||
return this._x;
|
||||
}
|
||||
|
||||
set y(y){
|
||||
this._y = y;
|
||||
}
|
||||
|
||||
get y(){
|
||||
return this._y;
|
||||
}
|
||||
|
||||
set siblings(siblings){
|
||||
this._siblings = siblings;
|
||||
}
|
||||
|
||||
get siblings(){
|
||||
return this._siblings;
|
||||
}
|
||||
|
||||
get radius(){
|
||||
if(this.isPointer){
|
||||
return 3;
|
||||
}
|
||||
return 2 * this._radius + 2 * this._siblings.length / this._config.siblingsLimit;
|
||||
}
|
||||
|
||||
// for each point find the 5 closest points
|
||||
for(let i = 0; i < points.length; i++){
|
||||
let closest = [];
|
||||
let p1 = points[i];
|
||||
for(let j = 0; j < points.length; j++){
|
||||
let p2 = points[j];
|
||||
if(p1 !== p2){
|
||||
let placed = false;
|
||||
for(let k = 0; k < connectionCount; k++){
|
||||
if(!placed){
|
||||
if(closest[k] === undefined){
|
||||
closest[k] = p2;
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let m = 0; m < connectionCount; m++){
|
||||
if(!placed){
|
||||
if(getDistance(p1, p2) < getDistance(p1, closest[m])){
|
||||
closest[m] = p2;
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
p1.closest = closest;
|
||||
set brightness(brightness){
|
||||
this._brightness = brightness;
|
||||
}
|
||||
|
||||
// assign a circle to each point
|
||||
for(let n in points){
|
||||
let c = new Circle(points[n], 2+Math.random()*2, 'rgba(255,255,255,0.3)');
|
||||
points[n].circle = c;
|
||||
get brightness(){
|
||||
return this.isPointer ? 1 : this._brightness;
|
||||
}
|
||||
};
|
||||
|
||||
// Event handling
|
||||
let addListeners = function(){
|
||||
if(!('ontouchstart' in window)){
|
||||
window.addEventListener('mousemove', mouseMove);
|
||||
set color(color){
|
||||
this._color = color;
|
||||
}
|
||||
window.addEventListener('scroll', scrollCheck);
|
||||
window.addEventListener('resize', resize);
|
||||
};
|
||||
|
||||
let mouseMove = function(e){
|
||||
let posx = 0;
|
||||
let posy = 0;
|
||||
if(e.pageX || e.pageY){
|
||||
posx = e.pageX;
|
||||
posy = e.pageY;
|
||||
}else if(e.clientX || e.clientY){
|
||||
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
|
||||
get color(){
|
||||
return this._color;
|
||||
}
|
||||
target.x = posx;
|
||||
target.y = posy;
|
||||
};
|
||||
|
||||
let scrollCheck = function(){
|
||||
if(document.body.scrollTop > height){
|
||||
animateHeader = false;
|
||||
}else{
|
||||
animateHeader = true;
|
||||
set isPointer(isPointer){
|
||||
this._isPointer = isPointer;
|
||||
}
|
||||
};
|
||||
|
||||
let resize = function(){
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
largeHeader.style.height = height+'px';
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
};
|
||||
|
||||
// animation
|
||||
let initAnimation = function(){
|
||||
animate();
|
||||
for(let i in points){
|
||||
shiftPoint(points[i]);
|
||||
get isPointer(){
|
||||
return this._isPointer;
|
||||
}
|
||||
};
|
||||
|
||||
let animate = function animate(){
|
||||
if(animateHeader){
|
||||
ctx.clearRect(0,0,width,height);
|
||||
for(let i in points){
|
||||
// detect points in range
|
||||
if(Math.abs(getDistance(target, points[i])) < 4000){
|
||||
points[i].active = 0.25;
|
||||
points[i].circle.active = 0.45;
|
||||
}else if(Math.abs(getDistance(target, points[i])) < 20000){
|
||||
points[i].active = 0.1;
|
||||
points[i].circle.active = 0.3;
|
||||
}else if(Math.abs(getDistance(target, points[i])) < 40000){
|
||||
points[i].active = 0.02;
|
||||
points[i].circle.active = 0.1;
|
||||
drawNode(){
|
||||
this._ctx.beginPath();
|
||||
this._ctx.arc(this.x, this.y, this.radius, 0, StarCanvas.circ);
|
||||
this._ctx.fillStyle = this.color.style(this.brightness * this._config.brightnessMultiplierNode);
|
||||
this._ctx.fill();
|
||||
}
|
||||
|
||||
drawConnections(){
|
||||
for(let i = 0; i < this._siblings.length; i++){
|
||||
this._ctx.beginPath();
|
||||
this._ctx.moveTo(this.x, this.y);
|
||||
this._ctx.lineTo(this._siblings[i].x, this._siblings[i].y);
|
||||
this._ctx.lineWidth = 1 - StarCanvas.calcDistance(this, this._siblings[i]) / this._config.sensitivity;
|
||||
if(this.color === this._siblings[i].color){
|
||||
// no gradient
|
||||
this._ctx.strokeStyle = this.color.style(this.brightness * this._config.brightnessMultiplierConnection);
|
||||
}else{
|
||||
points[i].active = 0;
|
||||
points[i].circle.active = 0;
|
||||
// gradient
|
||||
this._ctx.strokeStyle = this.gradient(this._siblings[i], StarCanvas.lineStyle(this, this._siblings[i])) ;
|
||||
}
|
||||
|
||||
drawLines(points[i]);
|
||||
points[i].circle.draw();
|
||||
this._ctx.stroke();
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(animate);
|
||||
};
|
||||
|
||||
let shiftPoint = function(p){
|
||||
TweenLite.to(p, 1 + 1 * Math.random(), {x: p.originX - 50 + Math.random() * 100,
|
||||
y: p.originY - 50 + Math.random() * 100, ease: Circ.easeInOut,
|
||||
onComplete: function(){
|
||||
shiftPoint(p);
|
||||
}});
|
||||
};
|
||||
|
||||
// Canvas manipulation
|
||||
let drawLines = function(p){
|
||||
if(!p.active) return;
|
||||
for(let i in p.closest){
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(p.x, p.y);
|
||||
ctx.lineTo(p.closest[i].x, p.closest[i].y);
|
||||
ctx.strokeStyle = 'rgba(' + colorRGB +','+ p.active+')';
|
||||
ctx.stroke();
|
||||
gradient(node2, midColor){
|
||||
let grad = this._ctx.createLinearGradient(Math.floor(this.x), Math.floor(this.y), Math.floor(node2.x), Math.floor(node2.y));
|
||||
grad.addColorStop(0, this.color.style(this.brightness * this._config.brightnessMultiplierConnection));
|
||||
grad.addColorStop(0.5, midColor);
|
||||
grad.addColorStop(1, node2.color.style(node2.brightness * this._config.brightnessMultiplierConnection));
|
||||
return grad;
|
||||
}
|
||||
|
||||
moveNode(){
|
||||
this._energy -= 2;
|
||||
if(this._energy < 1){
|
||||
this._energy = Math.random() * 100;
|
||||
if(this.x - this._anchorX < -this._config.anchorLength){
|
||||
this._vx = Math.random() * 2;
|
||||
}else if(this.x - this._anchorX > this._config.anchorLength){
|
||||
this._vx = Math.random() * -2;
|
||||
}else{
|
||||
this._vx = Math.random() * 4 - 2;
|
||||
}
|
||||
if(this.y - this._anchorY < -this._config.anchorLength){
|
||||
this._vy = Math.random() * 2;
|
||||
}else if (this.y - this._anchorY > this._config.anchorLength){
|
||||
this._vy = Math.random() * -2;
|
||||
}else{
|
||||
this._vy = Math.random() * 4 - 2;
|
||||
}
|
||||
}
|
||||
this.x += this._vx * this._energy / 100;
|
||||
this.y += this._vy * this._energy / 100;
|
||||
}
|
||||
}
|
||||
|
||||
class StarCanvas {
|
||||
constructor(canvas, config = {}) {
|
||||
this._canvas = canvas;
|
||||
this._config = Object.assign({}, new.target.defaultConfig, config);
|
||||
this._nodes = [];
|
||||
this._nodesQty = 0;
|
||||
this._updateActive = true;
|
||||
|
||||
this.resizeWindow();
|
||||
this._mouse = this._config.startCoordinates(this._canvas);
|
||||
|
||||
this._ctx = this._canvas.getContext('2d');
|
||||
this.initHandlers();
|
||||
this.initIntersectionObserver();
|
||||
this.initNodes();
|
||||
this.redrawCheck();
|
||||
}
|
||||
|
||||
findSiblings(){
|
||||
let node1, node2, distance;
|
||||
for(let i = 0; i < this._nodesQty; i++){
|
||||
node1 = this._nodes[i];
|
||||
node1.siblings = [];
|
||||
for(let j = 0; j < this._nodesQty; j++){
|
||||
node2 = this._nodes[j];
|
||||
if(node1 !== node2){
|
||||
distance = StarCanvas.calcDistance(node1, node2);
|
||||
if(distance < this._config.sensitivity){
|
||||
if(node1.siblings.length < this._config.siblingsLimit){
|
||||
node1.siblings.push(node2);
|
||||
}else{
|
||||
let node_sibling_distance = 0;
|
||||
let max_distance = 0;
|
||||
let s;
|
||||
for(let k = 0; k < this._config.siblingsLimit; k++){
|
||||
node_sibling_distance = StarCanvas.calcDistance(node1, node1.siblings[k]);
|
||||
if(node_sibling_distance > max_distance){
|
||||
max_distance = node_sibling_distance;
|
||||
s = k;
|
||||
}
|
||||
}
|
||||
if(distance < max_distance){
|
||||
node1.siblings.splice(s, 1);
|
||||
node1.siblings.push(node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redrawScene(){
|
||||
this.resizeWindow();
|
||||
this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||
this.findSiblings();
|
||||
// skip nodes move to move if they are outside the visible radius -> performance boost
|
||||
let haltRadius = this._config.mouseRadius + this._config.anchorLength;
|
||||
// mouse pointer node moves on mousemove
|
||||
this._pointerNode.x = this._mouse.x;
|
||||
this._pointerNode.y = this._mouse.y;
|
||||
let skipNodesMove = [this._pointerNode];
|
||||
|
||||
let i, node, distance;
|
||||
for(i = 0; i < this._nodesQty; i++){
|
||||
node = this._nodes[i];
|
||||
distance = StarCanvas.calcDistance({
|
||||
x: this._mouse.x,
|
||||
y: this._mouse.y
|
||||
}, node);
|
||||
|
||||
if(distance < this._config.mouseRadius){
|
||||
node.brightness = 1 - distance / this._config.mouseRadius;
|
||||
}else{
|
||||
node.brightness = 0;
|
||||
}
|
||||
|
||||
if(distance > haltRadius){
|
||||
skipNodesMove.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < this._nodesQty; i++){
|
||||
node = this._nodes[i];
|
||||
if(node.brightness){
|
||||
node.drawNode();
|
||||
node.drawConnections();
|
||||
}
|
||||
|
||||
if(!skipNodesMove.includes(node)){
|
||||
node.moveNode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redrawCheck(){
|
||||
if(this._updateActive){
|
||||
this.redrawScene();
|
||||
}
|
||||
requestAnimationFrame(() => this.redrawCheck());
|
||||
}
|
||||
|
||||
initNodes(){
|
||||
this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||
this._nodes = [];
|
||||
for(let i = this._config.density; i < this._canvas.width; i += this._config.density) {
|
||||
for(let j = this._config.density; j < this._canvas.height; j += this._config.density) {
|
||||
let node = new Node(i, j, this._ctx, this._config);
|
||||
if(typeof this._config.colorBase === 'function'){
|
||||
node.color = this._config.colorBase(node, this);
|
||||
}else{
|
||||
node.color = new Color(...this._config.colorBase);
|
||||
}
|
||||
this._nodes.push(node);
|
||||
this._nodesQty++;
|
||||
}
|
||||
}
|
||||
|
||||
// mouse cursor node
|
||||
this._pointerNode = new Node(
|
||||
this._mouse.x,
|
||||
this._mouse.y,
|
||||
this._ctx,
|
||||
this._config
|
||||
);
|
||||
this._pointerNode.color = new Color(...this._config.colorCursor);
|
||||
this._pointerNode.brightness = 1;
|
||||
this._pointerNode.isPointer = true;
|
||||
this._nodes.unshift(this._pointerNode);
|
||||
this._nodesQty++;
|
||||
}
|
||||
|
||||
initHandlers(){
|
||||
document.addEventListener('resize', () => this.resizeWindow(), false);
|
||||
document.addEventListener('mousemove', e => this.mousemoveHandler(e), true);
|
||||
}
|
||||
|
||||
initIntersectionObserver(){
|
||||
let intersectionCallback = entries => {
|
||||
let visiblePct = Math.floor(entries[0].intersectionRatio * 100);
|
||||
this._updateActive = visiblePct > 0;
|
||||
};
|
||||
|
||||
this._intersectionObserver = new IntersectionObserver(intersectionCallback, {
|
||||
threshold: [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
|
||||
});
|
||||
this._intersectionObserver.observe(this._canvas);
|
||||
}
|
||||
|
||||
mousemoveHandler(e){
|
||||
this._mouse.x = e.clientX;
|
||||
this._mouse.y = e.clientY;
|
||||
}
|
||||
|
||||
resizeWindow(){
|
||||
let dimension = this._config.newDimension(this);
|
||||
this._canvas.width = dimension.width;
|
||||
this._canvas.height = dimension.height;
|
||||
}
|
||||
}
|
||||
|
||||
StarCanvas.circ = 2 * Math.PI;
|
||||
StarCanvas.calcDistance = (node1, node2) => {
|
||||
return Math.sqrt(Math.pow(node1.x - node2.x, 2) + (Math.pow(node1.y - node2.y, 2)));
|
||||
};
|
||||
|
||||
let Circle = function(pos,rad,color){
|
||||
let _this = this;
|
||||
|
||||
// constructor
|
||||
(function(){
|
||||
_this.pos = pos || null;
|
||||
_this.radius = rad || null;
|
||||
_this.color = color || null;
|
||||
})();
|
||||
|
||||
this.draw = function(){
|
||||
if(!_this.active) return;
|
||||
ctx.beginPath();
|
||||
ctx.arc(_this.pos.x, _this.pos.y, _this.radius, 0, 2 * Math.PI, false);
|
||||
ctx.fillStyle = 'rgba(' + colorRGB + ','+ _this.active+')';
|
||||
ctx.fill();
|
||||
};
|
||||
StarCanvas.lineStyle = (node1, node2) => {
|
||||
let r = StarCanvas.mixComponents(node1.color.r, node2.color.r, node1.radius, node2.radius);
|
||||
let g = StarCanvas.mixComponents(node1.color.g, node2.color.g, node1.radius, node2.radius);
|
||||
let b = StarCanvas.mixComponents(node1.color.b, node2.color.b, node1.radius, node2.radius);
|
||||
let a = (node1.brightness + node2.brightness) / 2;
|
||||
return `rgba(${Math.floor(r)}, ${Math.floor(g)}, ${Math.floor(b)}, ${a})`;
|
||||
};
|
||||
|
||||
// Util
|
||||
let getDistance = function(p1, p2){
|
||||
return Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2);
|
||||
StarCanvas.mixComponents = (comp1, comp2, weight1, weight2) => {
|
||||
return (comp1*weight1 + comp2*weight2) / (weight1 + weight2);
|
||||
};
|
||||
|
||||
/**
|
||||
* init header animation
|
||||
* @param callback
|
||||
*/
|
||||
$.fn.initHeader = function(callback){
|
||||
largeHeader = $(this)[0];
|
||||
canvas = $(this).find('canvas:visible')[0];
|
||||
StarCanvas.getRandomIntInclusive = (min, max) => {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min +1)) + min;
|
||||
};
|
||||
|
||||
// header preview elements
|
||||
$('.' + config.previewElementClass).velocity('transition.bounceIn', {
|
||||
|
||||
StarCanvas.defaultConfig = {
|
||||
// how close next node must be to activate connection (in px)
|
||||
// shorter distance == better connection (line width)
|
||||
sensitivity: 90,
|
||||
// note that siblings limit is not 'accurate' as the node can actually have more connections than this value
|
||||
// that's because the node accepts sibling nodes with no regard to their current connections this is acceptable
|
||||
// because potential fix would not result in significant visual difference
|
||||
// more siblings == bigger node
|
||||
siblingsLimit: 30,
|
||||
// default node margin
|
||||
density: 50,
|
||||
// avoid nodes spreading
|
||||
anchorLength: 120,
|
||||
// highlight radius
|
||||
mouseRadius: 200,
|
||||
// values < 1 will lower the calculated node brightness [0-1]
|
||||
brightnessMultiplierNode: 1,
|
||||
// values < 1 will lower the calculated connection brightness [0-1]
|
||||
brightnessMultiplierConnection: 1,
|
||||
colorBase: [108, 174, 173], // teal
|
||||
colorCursor: [226, 138, 13], // orange
|
||||
// callback for canvas dimension re-calc
|
||||
newDimension: () => ({width: window.innerWidth, height: window.innerHeight}),
|
||||
// start coordinates (before mouse move)
|
||||
startCoordinates: canvas => ({
|
||||
x: canvas.width / 2,
|
||||
y: canvas.height / 2
|
||||
})
|
||||
};
|
||||
|
||||
let init = headerEl => {
|
||||
let previewEls = headerEl.getElementsByClassName(config.previewElementClass);
|
||||
|
||||
$(previewEls).velocity('transition.bounceIn', {
|
||||
duration: 600,
|
||||
stagger: 60,
|
||||
delay: 120,
|
||||
complete: function(){
|
||||
|
||||
// show header canvas animation
|
||||
let canvas = document.getElementById(config.canvasId);
|
||||
// not on mobile
|
||||
if(canvas){
|
||||
// header animation
|
||||
initHeader();
|
||||
initAnimation();
|
||||
addListeners();
|
||||
|
||||
$(canvas).velocity('fadeIn', {
|
||||
duration: 900,
|
||||
visibility: 'visible',
|
||||
complete: function(){
|
||||
if(callback !== undefined){
|
||||
callback();
|
||||
new StarCanvas(canvas, {
|
||||
brightnessMultiplierConnection: 0.9,
|
||||
colorBase: (starCanvas, node) => {
|
||||
let rgb = StarCanvas.defaultConfig.colorBase;
|
||||
switch(StarCanvas.getRandomIntInclusive(0, 4)){
|
||||
case 1: rgb = [ 92, 184, 92]; break; // green
|
||||
case 2: rgb = [ 68, 170, 130]; break; // aqua
|
||||
case 3: rgb = [194, 118, 12]; break; // orange dark
|
||||
case 4: rgb = StarCanvas.defaultConfig.colorBase; break;
|
||||
}
|
||||
}
|
||||
return new Color(...rgb);
|
||||
},
|
||||
colorCursor: [200, 184, 71], // red dark
|
||||
newDimension: starCanvas => ({
|
||||
width: window.innerWidth,
|
||||
height: starCanvas._canvas.closest(`#${config.headerId}`).getBoundingClientRect().height - 1 // border
|
||||
}),
|
||||
startCoordinates: canvas => ({
|
||||
x: canvas.width / 2 + 500,
|
||||
y: canvas.height / 2 + 50
|
||||
})
|
||||
});
|
||||
|
||||
canvas.classList.add('in');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
return {
|
||||
init
|
||||
};
|
||||
});
|
||||
12
public/js/v2.0.0-rc.1/lib/EasePack.min.js
vendored
12
public/js/v2.0.0-rc.1/lib/EasePack.min.js
vendored
@@ -1,12 +0,0 @@
|
||||
/*!
|
||||
* VERSION: beta 1.9.4
|
||||
* DATE: 2014-07-17
|
||||
* UPDATES AND DOCS AT: http://www.greensock.com
|
||||
*
|
||||
* @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
|
||||
* This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
|
||||
* Club GreenSock members, the software agreement that was issued with your membership.
|
||||
*
|
||||
* @author: Jack Doyle, jack@greensock.com
|
||||
**/
|
||||
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.Back",["easing.Ease"],function(t){var e,i,s,r=_gsScope.GreenSockGlobals||_gsScope,n=r.com.greensock,a=2*Math.PI,o=Math.PI/2,h=n._class,l=function(e,i){var s=h("easing."+e,function(){},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,s},_=t.register||function(){},u=function(t,e,i,s){var r=h("easing."+t,{easeOut:new e,easeIn:new i,easeInOut:new s},!0);return _(r,t),r},c=function(t,e,i){this.t=t,this.v=e,i&&(this.next=i,i.prev=this,this.c=i.v-e,this.gap=i.t-t)},p=function(e,i){var s=h("easing."+e,function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,r.config=function(t){return new s(t)},s},f=u("Back",p("BackOut",function(t){return(t-=1)*t*((this._p1+1)*t+this._p1)+1}),p("BackIn",function(t){return t*t*((this._p1+1)*t-this._p1)}),p("BackInOut",function(t){return 1>(t*=2)?.5*t*t*((this._p2+1)*t-this._p2):.5*((t-=2)*t*((this._p2+1)*t+this._p2)+2)})),m=h("easing.SlowMo",function(t,e,i){e=e||0===e?e:.7,null==t?t=.7:t>1&&(t=1),this._p=1!==t?e:0,this._p1=(1-t)/2,this._p2=t,this._p3=this._p1+this._p2,this._calcEnd=i===!0},!0),d=m.prototype=new t;return d.constructor=m,d.getRatio=function(t){var e=t+(.5-t)*this._p;return this._p1>t?this._calcEnd?1-(t=1-t/this._p1)*t:e-(t=1-t/this._p1)*t*t*t*e:t>this._p3?this._calcEnd?1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},m.ease=new m(.7,.7),d.config=m.config=function(t,e,i){return new m(t,e,i)},e=h("easing.SteppedEase",function(t){t=t||1,this._p1=1/t,this._p2=t+1},!0),d=e.prototype=new t,d.constructor=e,d.getRatio=function(t){return 0>t?t=0:t>=1&&(t=.999999999),(this._p2*t>>0)*this._p1},d.config=e.config=function(t){return new e(t)},i=h("easing.RoughEase",function(e){e=e||{};for(var i,s,r,n,a,o,h=e.taper||"none",l=[],_=0,u=0|(e.points||20),p=u,f=e.randomize!==!1,m=e.clamp===!0,d=e.template instanceof t?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;--p>-1;)i=f?Math.random():1/u*p,s=d?d.getRatio(i):i,"none"===h?r=g:"out"===h?(n=1-i,r=n*n*g):"in"===h?r=i*i*g:.5>i?(n=2*i,r=.5*n*n*g):(n=2*(1-i),r=.5*n*n*g),f?s+=Math.random()*r-.5*r:p%2?s+=.5*r:s-=.5*r,m&&(s>1?s=1:0>s&&(s=0)),l[_++]={x:i,y:s};for(l.sort(function(t,e){return t.x-e.x}),o=new c(1,1,null),p=u;--p>-1;)a=l[p],o=new c(a.x,a.y,o);this._prev=new c(0,0,0!==o.t?o:o.next)},!0),d=i.prototype=new t,d.constructor=i,d.getRatio=function(t){var e=this._prev;if(t>e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&e.t>=t;)e=e.prev;return this._prev=e,e.v+(t-e.t)/e.gap*e.c},d.config=function(t){return new i(t)},i.ease=new i,u("Bounce",l("BounceOut",function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}),l("BounceIn",function(t){return 1/2.75>(t=1-t)?1-7.5625*t*t:2/2.75>t?1-(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}),l("BounceInOut",function(t){var e=.5>t;return t=e?1-2*t:2*t-1,t=1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5})),u("Circ",l("CircOut",function(t){return Math.sqrt(1-(t-=1)*t)}),l("CircIn",function(t){return-(Math.sqrt(1-t*t)-1)}),l("CircInOut",function(t){return 1>(t*=2)?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)})),s=function(e,i,s){var r=h("easing."+e,function(t,e){this._p1=t||1,this._p2=e||s,this._p3=this._p2/a*(Math.asin(1/this._p1)||0)},!0),n=r.prototype=new t;return n.constructor=r,n.getRatio=i,n.config=function(t,e){return new r(t,e)},r},u("Elastic",s("ElasticOut",function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*a/this._p2)+1},.3),s("ElasticIn",function(t){return-(this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2))},.3),s("ElasticInOut",function(t){return 1>(t*=2)?-.5*this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2):.5*this._p1*Math.pow(2,-10*(t-=1))*Math.sin((t-this._p3)*a/this._p2)+1},.45)),u("Expo",l("ExpoOut",function(t){return 1-Math.pow(2,-10*t)}),l("ExpoIn",function(t){return Math.pow(2,10*(t-1))-.001}),l("ExpoInOut",function(t){return 1>(t*=2)?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))})),u("Sine",l("SineOut",function(t){return Math.sin(t*o)}),l("SineIn",function(t){return-Math.cos(t*o)+1}),l("SineInOut",function(t){return-.5*(Math.cos(Math.PI*t)-1)})),h("easing.EaseLookup",{find:function(e){return t.map[e]}},!0),_(r.SlowMo,"SlowMo","ease,"),_(i,"RoughEase","ease,"),_(e,"SteppedEase","ease,"),f},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();
|
||||
12
public/js/v2.0.0-rc.1/lib/TweenLite.min.js
vendored
12
public/js/v2.0.0-rc.1/lib/TweenLite.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<div id="{{id}}" class="alert alert-warning">
|
||||
<div class="ui-pnotify-icon"><span class="fas fa-exclamation fa-fw fa-lg"></span></div>
|
||||
<h4 class="ui-pnotify-title">Scheduled maintenance: Update v1.5.5 <i class="fas fa-long-arrow-alt-right"></i> v2.0.0-rc.1; Shutdown: ~12:00 (UTC). ETA ~13:00 (UTC)</h4>
|
||||
<h4 class="ui-pnotify-title">Scheduled maintenance: Bug fixes (may require re-authentication); Shutdown: ~15:30 (UTC). ETA ~15:45 (UTC)</h4>
|
||||
</div>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<include href="templates/ui/admin_panel.html"/>
|
||||
|
||||
<div id="pf-header-container">
|
||||
<canvas id="pf-header-canvas" class="hidden-xs" width="500" height="480"></canvas>
|
||||
<canvas id="pf-header-canvas" class="hidden-xs fade" width="100%" height="480"></canvas>
|
||||
<div class="container">
|
||||
<div id="pf-logo-container"></div>
|
||||
|
||||
|
||||
@@ -189,8 +189,10 @@
|
||||
|
||||
}
|
||||
// header --------------------------------------------------------------------
|
||||
$headerHeight: 355px;
|
||||
|
||||
#pf-landing-top{
|
||||
height: 355px;
|
||||
height: $headerHeight;
|
||||
border-bottom: 1px solid $gray-dark;
|
||||
position: relative;
|
||||
|
||||
@@ -216,9 +218,22 @@
|
||||
|
||||
#pf-header-canvas{
|
||||
position: absolute;
|
||||
visibility: hidden; // triggered by js
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
&.fade.in{
|
||||
cursor: none;
|
||||
|
||||
~ .container{
|
||||
cursor: none;
|
||||
}
|
||||
}
|
||||
|
||||
~ .container{
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
max-height: $headerHeight - 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#pf-logo-container{
|
||||
@@ -265,11 +280,6 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.container{
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#pf-header-preview-intel{
|
||||
|
||||
Reference in New Issue
Block a user