gsap+svg实现radio单选选择动画效果代码

代码语言:html

所属分类:布局界面

代码描述:gsap+svg实现radio单选选择动画效果代码

代码标签: gsap svg radio 单选 选择 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@400&family=PT+Sans+Narrow&family=Turret+Road:wght@700&display=swap");
html,
body {
  height: 100%;
}

body {
  background-color: #3d3e4a;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  font-family: "Oswald", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-size: 28px;
}

.container {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
}

.radio-btn-group {
  margin: 10px;
}

label {
  display: flex;
  align-items: center;
}
label span {
  margin-left: 15px;
}

input[type=radio] {
  opacity: 0;
  position: absolute;
}

input[type=radio]:focus-visible + label {
  outline: 2px solid #05eafa;
  outline-offset: 4px;
  border-radius: 6px;
}

svg rect {
  shape-rendering: crispEdges;
}
svg .blue rect {
  fill: #05eafa;
  mix-blend-mode: color-dodge;
}
svg .pink rect {
  fill: #f52cb9;
}
</style>


  
  
</head>

<body translate="no">
  <div class="container">
  <div class="radio-btn-group">
    <input type="radio" name="stagger-radio-group" value="1" id="input-one" />
    <label for="input-one">
      <svg width="50" height="50" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
        <defs>
          <clipPath id="diamond-clip">
            <polygon points="25,0 50,25 25,50 0,25" />
          </clipPath>
        </defs>
        <rect width="50" height="50" fill="#24252c" clip-path="url(#diamond-clip)" />
        <g clip-path="url(#diamond-clip)">
          <g class="pink">
   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0