BLOG ACTIVO!!! SUBO UNA ENTRADA DIARIA, HABLANDO DE MI VIDA O COSITAS INTERESANTES ;)
BLOG ACTIVO!!! SUBO UNA ENTRADA DIARIA, HABLANDO DE MI VIDA O COSITAS INTERESANTES ;)

jueves, 20 de agosto de 2026

Gatito acariciable (Tuto)

Holi holiii, una personita me ha pedido tuto del gatito acariciable súper moni y aquí lo tenéisssss!!

Espero que todo se entienda súper bien y cualquier duda dejad un mensajitoooo ;)

Os va a quedar igual de bonito que el mío o incluso más jejjejj <3


Para crear este gadget necesitaremos un código que encontraréis al final del todo, donde tendréis que modificarlo a vuestro gusto y luego en diseño, añadir gadget HTML/JavaScript y pegar el código completo en el contenido para guardarlo ;)

Primero vamos aquí, que es donde tendremos que poner el URL de nuestro animalito. ABAJO DE LOS PASOS OS DEJARÉ URL DE ANIMALES POR SI QUERÉIS USARLOS!!!

Luego vamos donde dice gatito acariciable, aquí modificaremos
el tamaño del espacio que ocupa el gatito junto al texto (el gadget completo). Mi blog tiene un espacio de 250px entonces he puesto el tamaño del gadget a 200px ;)



Luego bajamos a la parte donde dice gatito area, y pondremos lo mismo que en el anterior, con esto habremos modificado la zona donde se moverá el gatito.



Vamos donde pone gatito img, y aquí por último modificaremos el tamaño de la imagen del gatito, yo lo tengo de ancho (width) 200px y alto (height) 200px



Por último vamos a la parte que dice texto acariciame y aquí modificaremos todo lo del texto:

- Primero cambiamos el ancho del texto, el mío está en 200px
- Segundo cambiamos la tipografía del texto, yo lo tengo en Georgia
- Tercero cambiamos el tamaño de la letra, la mía está en 23px
- Cuarto podemos poner el texto con el color que queráis ;)








Leopardo:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-nKplEO3Djb7LEwcDw9JrbEtEKp04HGQPk7bQpOn1uqSwumj0YI6nh9qImJeFwkYW-asvbHOye59fh52_f_0x495PnypMqx9SfrWHHvvrKxGfjDObzn1tc8xDtWpN0XWcNzRfSeo-KHSFoiFO_6Tgq9u6TOIQVhrmDzdt0TvjeFORtAK8cm2ztkGwQwnX/s584/IMG_1753.png 










Conejito:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPhjhkB2sJ7F0nJ39Rr-IY1_WEdkXxVbec5jEQmBPAYDtMBNZBgNfZ1a5NqCOsm425G2cbWRL1j0pU0ov72ciDES7L_E1x68Krn8WM_WxO0KQqp2dagujbIAJgfCdwmScRv6AHRuEMEsGupVAR1Hh_KVgmKuk5tWMdq5kHgQNhf4KopL0zFQhU5bMQLOey/s500/IMG_1754.png 










Ciervo:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguXDImQHESLV8tETXg1aLrwq3lRveG3PQPv842PXH1VyLgRfwMny0_11wKLmz8fbtL1ZZN6F3KoHfthX52vJva2DqHPVQp4fZ4DlamaSOuaLo30JEBHQoaxdqx_4S3oM6KcLjOXQPKmqB5YiUqNhQeialHh5vXEbvm4c5RRQCvu-GwuLPuE59xrPx6nPgX/s541/IMG_1755.png 










Zorro:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOEpLLShYuJ90aX8ZY5-cPMB5-g1ylOkmrI9r7qflI8MAF7PicRvabkQi663ULzTYriee-_U9pIr6um-1ApI4ju2ZA5UA3Lcl5upUSlJv35mNeC9vt9UnsxU7sZ1WA6UZBM9UozMwQXyqIVIcNj3gb_0lGw1fVmo3haJkT9nuQv_2p5MVgzeaGICRclwFR/s500/IMG_1756.png 








Gato naranja:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnyAjNj-7sJxAsZ02FVJuyrzbcVVF_tfLYYEHBWkKuY2sMABkfRVmu5tDrnBjkeXrU9x3h86OFClGP4p03zZJXc3boMEsEFn3tKCK-JihGxcxkq6SvoAKX0eHXLQXgETTYh7ZEBwKgUdop6JqOs7ZZL2DUjcu8SgWN3WT4kS9lrlf7vip0NxqVL5JA-9qE/s500/IMG_1752.png 


<!-- 🐱 GATITO ACARICIABLE -->


<div id="gatito-acariciable">


  <div id="texto-acariciame">

    ¡Acaríciame!

  </div>


  <div class="gatito-area">


    <img

      id="gatito-img"

      src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzPRydKpHClKV_VsavShhskvQ7IQLRgpm0pxhK0O3-IPipFzpizb1n8fbMdFpMEC465uO_XciWrElPidhBmVay797B3luskAjkiC-ydJXVq6uiPjDUol0ey4njN2q2mKyAH94j-R3NLSjGJi-garE7vFweMHnEopqY4AdBAaIDc2B4O6Mce_UxYV3dyUwv/s531/IMG_1572.png"

      alt="Gatito"

    >


  </div>


</div>



<style>


#gatito-acariciable {

  width: 200px;

  margin: 0 auto;

  text-align: center;

  user-select: none;

  -webkit-user-select: none;

}


#texto-acariciame {

  width: 200px;

  margin: 0 auto 2px;

  font-family: Georgia, serif;

  font-size: 23px;

  line-height: 1.15;

  text-align: center;

  color: #333;

}


.gatito-area {

  position: relative;

  width: 200px;

  height: 200px;

  margin: 0 auto;

  overflow: visible;

  cursor: pointer;

  touch-action: none;

}


#gatito-img {

  position: absolute;

  width: 200px;

  height: 200px;

  left: 0;

  top: 0;

  object-fit: contain;

  pointer-events: none;

  transform: translate(0, 0) scaleX(1) scaleY(1);

  transition: transform 0.65s cubic-bezier(0.25, 0.8, 0.25, 1);

}


.gatito-area.acariciando #gatito-img {

  filter: drop-shadow(0 0 5px rgba(255, 150, 180, 0.15));

}


</style>



<script>


(function() {


  const zona = document.querySelector("#gatito-acariciable .gatito-area");

  const gatito = document.getElementById("gatito-img");


  let ratonAnteriorX = null;

  let ratonAnteriorY = null;

  let moviendo = false;

  let volverCentro = null;


  function moverGatito(x, y) {


    if (ratonAnteriorX === null || ratonAnteriorY === null) {

      ratonAnteriorX = x;

      ratonAnteriorY = y;

      return;

    }


    const diferenciaX = x - ratonAnteriorX;

    const diferenciaY = y - ratonAnteriorY;


    ratonAnteriorX = x;

    ratonAnteriorY = y;


    if (Math.abs(diferenciaX) < 1 && Math.abs(diferenciaY) < 1) {

      return;

    }


    const intensidadX = Math.min(Math.abs(diferenciaX), 18);

    const intensidadY = Math.min(Math.abs(diferenciaY), 18);


    const movimientoHorizontal =

      Math.abs(diferenciaX) > Math.abs(diferenciaY);


    let escalaX = 1;

    let escalaY = 1;


    if (movimientoHorizontal) {


      escalaX = 1 + intensidadX * 0.025;

      escalaY = 1 - intensidadX * 0.010;


    } else {


      escalaY = 1 + intensidadY * 0.030;

      escalaX = 1 - intensidadY * 0.018;


    }


    escalaX = Math.max(0.70, Math.min(1.45, escalaX));

    escalaY = Math.max(0.70, Math.min(1.45, escalaY));


    const moverX = Math.max(-3, Math.min(3, diferenciaX * 0.10));

    const moverY = Math.max(-3, Math.min(3, diferenciaY * 0.10));


    gatito.style.transform =

      "translate(" + moverX + "px, " + moverY + "px) " +

      "scaleX(" + escalaX + ") " +

      "scaleY(" + escalaY + ")";


    zona.classList.add("acariciando");


    clearTimeout(volverCentro);


    volverCentro = setTimeout(function() {


      gatito.style.transform =

        "translate(0, 0) scaleX(1) scaleY(1)";


      zona.classList.remove("acariciando");


    }, 650);

  }



  /* RATÓN */


  zona.addEventListener("mouseenter", function(e) {


    moviendo = true;


    const rect = zona.getBoundingClientRect();


    ratonAnteriorX = e.clientX - rect.left;

    ratonAnteriorY = e.clientY - rect.top;


  });


  zona.addEventListener("mousemove", function(e) {


    if (!moviendo) return;


    const rect = zona.getBoundingClientRect();


    moverGatito(

      e.clientX - rect.left,

      e.clientY - rect.top

    );


  });


  zona.addEventListener("mouseleave", function() {


    moviendo = false;


    ratonAnteriorX = null;

    ratonAnteriorY = null;


    clearTimeout(volverCentro);


    gatito.style.transform =

      "translate(0, 0) scaleX(1) scaleY(1)";


    zona.classList.remove("acariciando");


  });



  /* MÓVIL */


  zona.addEventListener("touchstart", function(e) {


    e.preventDefault();


    const toque = e.touches[0];

    const rect = zona.getBoundingClientRect();


    ratonAnteriorX = toque.clientX - rect.left;

    ratonAnteriorY = toque.clientY - rect.top;


    moviendo = true;


  }, { passive: false });



  zona.addEventListener("touchmove", function(e) {


    e.preventDefault();


    if (!moviendo) return;


    const toque = e.touches[0];

    const rect = zona.getBoundingClientRect();


    moverGatito(

      toque.clientX - rect.left,

      toque.clientY - rect.top

    );


  }, { passive: false });



  function terminarToque() {


    moviendo = false;


    ratonAnteriorX = null;

    ratonAnteriorY = null;


    clearTimeout(volverCentro);


    gatito.style.transform =

      "translate(0, 0) scaleX(1) scaleY(1)";


    zona.classList.remove("acariciando");


  }


  zona.addEventListener("touchend", terminarToque);

  zona.addEventListener("touchcancel", terminarToque);


})();


</script>



1 comentario:

  1. Omgg, es tan lindooo definitivamente lo pondré en mi blog! Muchas gracias por el tutorial o( ˶^▾^˶ )o

    ResponderEliminar