How to change GRADIENT with code?

Makes sense, thanks for your attentiveness.

Unfortunately I’m too stupid to convert the html/css code to JS. Do you know of any AI converter? Perhaps ChatGPT can get the job done? :joy:

<!doctype html>
<html>
  <style>
    @import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
    .btn {
      width: 150px;
      height: 40px;
      background-image: linear-gradient(to right, #00A6FF 0%, #046CFC  51%, #00A6FF  100%);
      transition: 0.5s;
      color: white;
      border: 0;
      border-radius: 25px;
      font-family: poppins;
      font-size: 16px;
      text-align: center;
      display: block;
      box-shadow: 0 0 20px #eee;
      background-size: 200% auto;
    }

    .btn:hover {
      background-position: right center;
      color: #fff;
      text-decoration: none;
    }
  </style>

  <button class="btn">Buy now</button>
</html>