H5 css动画效果

你可以使用 CSS 动画来实现这个效果。下面是一个简单的示例代码,展示了如何使用 CSS 中的关键帧动画来放大然后缩小一张图片,并使动画循环播放: ```html
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image Animation</title>
    <style>
        /* 定义动画 */
        
        @keyframes zoomInOut {
            0% {
                transform: scale(1);
                /* 初始大小 */
            }
            50% {
                transform: scale(1.2);
                /* 放大到120% */
            }
            100% {
                transform: scale(1);
                /* 缩小回原始大小 */
            }
        }
        /* 应用动画到图片 */
        
        .animated-image {
            animation: zoomInOut 4s ease-in-out infinite;
            /* 播放时间为4秒,循环播放 */
            width: 200px;
            /* 图片宽度 */
            height: auto;
            /* 让高度自适应宽度变化 */
        }
    </style>
</head>

<body>

    <!-- 图片 -->
    <img src="./1.jpg" class="animated-image" alt="Animated Image">

</body>

</html>

1、定义动画

2、使用动画

from 和to 相当于0%和100%

简写方式

相关推荐

  1. css 多种动画效果

    2024-05-10 08:50:01       65 阅读
  2. CSS动画效果

    2024-05-10 08:50:01       42 阅读
  3. css动画旋转效果实现

    2024-05-10 08:50:01       54 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-10 08:50:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-10 08:50:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-05-10 08:50:01       87 阅读
  4. Python语言-面向对象

    2024-05-10 08:50:01       96 阅读

热门阅读

  1. SVG在HTML中的魔法:解锁矢量图形的奥秘

    2024-05-10 08:50:01       35 阅读
  2. 计算机视觉(CV)(Computer Vision)

    2024-05-10 08:50:01       37 阅读
  3. 设计模式——中介者模式(Mediator)

    2024-05-10 08:50:01       34 阅读
  4. MySQL商城数据表(80-84)

    2024-05-10 08:50:01       32 阅读
  5. [CAM_REQ_MGR_EVENT_MAX]高通6225平台相机老化异常重启

    2024-05-10 08:50:01       30 阅读
  6. vue的组件库

    2024-05-10 08:50:01       34 阅读
  7. 图解JVM出现的参数

    2024-05-10 08:50:01       46 阅读