thema de comienzo con efectos
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
/* Animated background from trivelta: drifting orbs, particle canvas, grain. */
|
||||
|
||||
.ambient-bg {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
body > header,
|
||||
body > main,
|
||||
body > footer {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.ambient-bg__canvas {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.ambient-bg__orbs {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ambient-bg__orb {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(100px);
|
||||
}
|
||||
|
||||
.ambient-bg__orb--a {
|
||||
top: -260px;
|
||||
left: -180px;
|
||||
width: 680px;
|
||||
height: 680px;
|
||||
background: radial-gradient(circle, #0a4fd1, transparent 70%);
|
||||
opacity: 0.55;
|
||||
animation: ambient-drift-1 22s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.ambient-bg__orb--b {
|
||||
top: 30%;
|
||||
right: -240px;
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
background: radial-gradient(circle, #1f7ae5, transparent 70%);
|
||||
opacity: 0.34;
|
||||
animation: ambient-drift-2 26s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.ambient-bg__orb--c {
|
||||
bottom: -220px;
|
||||
left: 34%;
|
||||
width: 560px;
|
||||
height: 560px;
|
||||
background: radial-gradient(circle, #4fb8ff, transparent 70%);
|
||||
opacity: 0.22;
|
||||
animation: ambient-drift-3 30s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.ambient-bg__grain {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
opacity: 0.04;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
@keyframes ambient-drift-1 {
|
||||
0%,
|
||||
100% { transform: translate(0, 0); }
|
||||
50% { transform: translate(80px, 60px); }
|
||||
}
|
||||
|
||||
@keyframes ambient-drift-2 {
|
||||
0%,
|
||||
100% { transform: translate(0, 0); }
|
||||
50% { transform: translate(-90px, 40px); }
|
||||
}
|
||||
|
||||
@keyframes ambient-drift-3 {
|
||||
0%,
|
||||
100% { transform: translate(0, 0); }
|
||||
50% { transform: translate(60px, -70px); }
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
.ambient-bg__canvas,
|
||||
.ambient-bg__orbs {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ambient-bg__orb {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.ambient-bg__canvas {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/* Animated background from trivelta: aurora orbs plus a particle constellation. */
|
||||
(function () {
|
||||
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
var root = document.createElement('div');
|
||||
root.className = 'ambient-bg';
|
||||
root.setAttribute('aria-hidden', 'true');
|
||||
root.innerHTML = '<canvas class="ambient-bg__canvas"></canvas>'
|
||||
+ '<div class="ambient-bg__orbs">'
|
||||
+ '<div class="ambient-bg__orb ambient-bg__orb--a"></div>'
|
||||
+ '<div class="ambient-bg__orb ambient-bg__orb--b"></div>'
|
||||
+ '<div class="ambient-bg__orb ambient-bg__orb--c"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="ambient-bg__grain"></div>';
|
||||
document.body.insertBefore(root, document.body.firstChild);
|
||||
|
||||
var canvas = root.querySelector('.ambient-bg__canvas');
|
||||
|
||||
if (reduceMotion || window.innerWidth < 900) {
|
||||
canvas.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
var width = 0;
|
||||
var height = 0;
|
||||
var dpr = 1;
|
||||
var points = [];
|
||||
|
||||
function resize() {
|
||||
dpr = Math.min(window.devicePixelRatio || 1, 2);
|
||||
width = canvas.width = window.innerWidth * dpr;
|
||||
height = canvas.height = window.innerHeight * dpr;
|
||||
canvas.style.width = window.innerWidth + 'px';
|
||||
canvas.style.height = window.innerHeight + 'px';
|
||||
|
||||
var count = Math.min(70, Math.floor(window.innerWidth / 22));
|
||||
points = [];
|
||||
|
||||
for (var i = 0; i < count; i++) {
|
||||
points.push({
|
||||
x: Math.random() * width,
|
||||
y: Math.random() * height,
|
||||
vx: (Math.random() - 0.5) * 0.12 * dpr,
|
||||
vy: (Math.random() - 0.5) * 0.12 * dpr
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function loop() {
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var point = points[i];
|
||||
point.x += point.vx;
|
||||
point.y += point.vy;
|
||||
if (point.x < 0 || point.x > width) point.vx *= -1;
|
||||
if (point.y < 0 || point.y > height) point.vy *= -1;
|
||||
}
|
||||
|
||||
for (var a = 0; a < points.length; a++) {
|
||||
for (var b = a + 1; b < points.length; b++) {
|
||||
var dx = points[a].x - points[b].x;
|
||||
var dy = points[a].y - points[b].y;
|
||||
var distance = Math.hypot(dx, dy);
|
||||
var maxDistance = 150 * dpr;
|
||||
|
||||
if (distance < maxDistance) {
|
||||
ctx.strokeStyle = 'rgba(79, 184, 255, ' + (0.16 * (1 - distance / maxDistance)) + ')';
|
||||
ctx.lineWidth = dpr;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(points[a].x, points[a].y);
|
||||
ctx.lineTo(points[b].x, points[b].y);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
ctx.fillStyle = 'rgba(120, 170, 255, 0.5)';
|
||||
ctx.beginPath();
|
||||
ctx.arc(points[a].x, points[a].y, 1.4 * dpr, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(loop);
|
||||
}
|
||||
|
||||
resize();
|
||||
window.addEventListener('resize', resize);
|
||||
window.requestAnimationFrame(loop);
|
||||
}());
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Animated background from trivelta.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_animated_background_assets() {
|
||||
$dir = get_template_directory() . '/parts/animated-background';
|
||||
$uri = get_template_directory_uri() . '/parts/animated-background';
|
||||
|
||||
wp_enqueue_style(
|
||||
'alcastromol-animated-background',
|
||||
$uri . '/animated-background.css',
|
||||
array(),
|
||||
filemtime( $dir . '/animated-background.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'alcastromol-animated-background',
|
||||
$uri . '/animated-background.js',
|
||||
array(),
|
||||
filemtime( $dir . '/animated-background.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'alcastromol_animated_background_assets' );
|
||||
Reference in New Issue
Block a user