<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Texto Circular Mejorado</title>
<style>
#outerCircleText {
font-style: italic;
font-weight: bold;
font-family: 'Verdana', Arial, sans-serif;
color: #FFFFFF;
position: absolute;
top: 0;
left: 0;
z-index: 3000;
cursor: default;
pointer-events: none; /* Evita interferencia con el ratón */
}
#outerCircleText div {
position: relative;
}
#outerCircleText div div {
position: absolute;
top: 0;
left: 0;
text-align: center;
}
body {
margin: 0;
padding: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #f093fb, #f5576c);
overflow: hidden;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<script>
(function () {
var msg = "¡ESTUDIA INGLÉS, COMPUTACIÓN, BACHILLERATO EN SUS DIFERENTES MODALIDADES, LOGRA EL ÉXITO!";
var size = 30;
var circleY = 0.75, circleX = 2.5;
var letter_spacing = 5;
var diameter = 5;
var rotation = 0.3;
var speed = 0.07;
if (!window.addEventListener || !document.createElement) return;
msg = msg.split('');
var n = msg.length - 1, a = Math.round(size * diameter * 0.408333),
currStep = 20, ymouse = a * circleY + 20, xmouse = a * circleX + 20, y = [], x = [], Y = [], X = [],
o = document.createElement('div'), oi = document.createElement('div'),
b = document.compatMode && document.compatMode !== "BackCompat" ? document.documentElement : document.body,
mouse = function (e) {
e = e || window.event;
ymouse = !isNaN(e.pageY) ? e.pageY : e.clientY;
xmouse = !isNaN(e.pageX) ? e.pageX : e.clientX;
},
makecircle = function () {
currStep -= rotation;
for (var d, i = n; i > -1; --i) {
d = document.getElementById('iemsg' + i).style;
d.top = Math.round(y[i] + a * Math.sin((currStep + i) / letter_spacing) * circleY - 15) + 'px';
d.left = Math.round(x[i] + a * Math.cos((currStep + i) / letter_spacing) * circleX) + 'px';
}
},
drag = function () {
y[0] = Y[0] += (ymouse - Y[0]) * speed;
x[0] = X[0] += (xmouse - 20 - X[0]) * speed;
for (var i = n; i > 0; --i) {
y[i] = Y[i] += (y[i - 1] - Y[i]) * speed;
x[i] = X[i] += (x[i - 1] - X[i]) * speed;
}
makecircle();
},
init = function () {
for (var d, i = n; i > -1; --i) {
d = document.createElement('div'); d.id = 'iemsg' + i;
d.style.height = d.style.width = a + 'px';
d.appendChild(document.createTextNode(msg[i]));
oi.appendChild(d); y[i] = x[i] = Y[i] = X[i] = 0;
}
o.appendChild(oi); document.body.appendChild(o);
setInterval(drag, 25);
};
o.id = 'outerCircleText'; o.style.fontSize = size + 'px';
o.style.backgroundImage = 'linear-gradient(to right, #ff9a9e, #fad0c4)';
o.style.color = 'white';
o.style.textShadow = '2px 2px 4px rgba(0,0,0,0.3)';
o.style.padding = '10px';
if (window.addEventListener) {
window.addEventListener('load', init, false);
document.addEventListener('mousemove', mouse, false);
}
})();
</script>
</body>
</html>
viernes, 31 de agosto de 2018
HTML: Práctica 9
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario