lunes, 8 de enero de 2024

Dispara cudrados toca la pantalla

Toca el cuadrado rojo con el dedo, luego el azul .....y asi sucesibamente........

Click on the red square to see the effect


<!DOCTYPE html>
<html>
<head>
<style>
.container {
  width: 200px;
  height: 200px;
  position: relative;
  background-color: #f1f1f1;
}

.square {
  width: 50px;
  height: 50px;
  position: absolute;
  background-color: red;
  cursor: pointer;
}

.square:hover ~ .moving-square {
  animation: move-up 1s ease-in-out forwards;
}

@keyframes move-up {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-100px);
  }
}

.moving-square {
  width: 50px;
  height: 50px;
  position: absolute;
  background-color: blue;
  top: 200px;
}
</style>
</head>
<body>

<h2>Click on the red square to see the effect</h2>

<div class="container">
  <div class="square"></div>
  <div class="moving-square"></div>
</div>

</body>
</html>

Circulos volando

<!DOCTYPE html>
<html>
<head>
  <style>
    #square {
      width: 200px;
      height: 200px;
      background-color: lightblue;
      position: relative;
    }

    .circle {
      width: 20px;
      height: 20px;
      background-color: white;
      border-radius: 50%;
      position: absolute;
      animation: move 2s ease-in-out infinite;
    }

    @keyframes move {
      0% {
        transform: rotate(0deg) translate(0, 0);
      }
      100% {
        transform: rotate(360deg) translate(100px, 0);
      }
    }
  </style>
</head>
<body>
  <div id="square" ontouchstart="createCircle(event)">
  </div>

  <script>
    function createCircle(event) {
      var x = event.touches[0].clientX;
      var y = event.touches[0].clientY;
      var circle = document.createElement("div");
      circle.classList.add("circle");
      circle.style.left = x + "px";
      circle.style.top = y + "px";
      document.getElementById("square").appendChild(circle);
    }
  </script>
</body>
</html>




TOCA CON EL DEDO REP
PETIDAMENTE LA PANTALLA DEL TELEFONO....EN EL CUADRADO AZUL