当前位置: 首页 > wzjs >正文

东莞樟木头哪里有做网站的缅甸今日新闻

东莞樟木头哪里有做网站的,缅甸今日新闻,厦门小程序开发,9377将军传奇一、CSS3 动画 CSS3 动画是一种通过纯CSS实现动画效果的技术,它允许开发者在不使用JavaScript或Flash的情况下,为网页元素添加平滑的过渡和动画效果。CSS3 动画的引入,极大地增强了网页的表现力和用户体验。 二、 CSS3 动画的关键组成部分 1…

一、CSS3 动画

     CSS3 动画是一种通过纯CSS实现动画效果的技术,它允许开发者在不使用JavaScript或Flash的情况下,为网页元素添加平滑的过渡和动画效果。CSS3 动画的引入,极大地增强了网页的表现力和用户体验。

二、 CSS3 动画的关键组成部分

1、设置关键帧

@keyframes  animationname  {  

         from {/*CSS样式写在这里*/}    

         percentage {/*CSS样式写在这里*/}  

         to {/*CSS样式写在这里*/}

}

 2、调用关键帧

 animation 属性用于将 @keyframes 动画绑定到元素上,并控制动画的播放。它可以包含多个子属性,如 animation-nameanimation-durationanimation-timing-functionanimation-delayanimation-iteration-countanimation-direction 等

  语法 :

animation属性 :

性名称作用描述可选值默认值
animation-name指定关键帧动画名称keyframename | nonenone
animation-duration单次动画持续时间时间单位(s/ms)0s
animation-timing-function动画速度曲线ease | linear | ease-in | ease-out | ease-in-out | steps(n)ease
animation-delay动画延迟时间时间单位(允许负值)0s
animation-iteration-count动画播放次数number | infinite1
animation-direction动画播放方向normal | reverse | alternate | alternate-reversenormal
animation-fill-mode动画外样式应用none | forwards | backwards | bothnone
animation-play-state动画播放状态控制running | pausedrunning

说明:

  • animation-direction

    • 作用:控制播放方向
    • 参数:
      normal:正向播放
      reverse:反向播放
      alternate:奇数次正向,偶数次反向
      alternate-reverse:奇数次反向,偶数次正向
  • animation-fill-mode

    • 作用:设置动画执行前后样式状态
    • 参数:
      none:默认状态
      forwards:保留最后一帧样式
      backwards:应用第一帧样式
      both:同时应用前后状态
  • animation-play-state

    • 作用:控制动画播放状态
    • 参数:

                running:将暂停的动画重新播放

                paused:将正在播放的元素动画停下来

 三、CSS3 动画的优势

  • 纯CSS实现:无需依赖JavaScript或第三方库,减少了代码的复杂性和加载时间。

  • 性能优化:浏览器对CSS动画进行了优化,通常比JavaScript动画更加流畅和高效。

  • 易于维护:CSS动画与页面样式分离,使得样式和动画的维护更加容易。

  • 兼容性:现代浏览器普遍支持CSS3动画,具有良好的兼容性。

四、动画应用 

1、背景动画(通过改变背景图片的位置来实现动画效果。

<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>背景动画</title><style>body {display: flex; /* 使用弹性布局 */justify-content: center; /* 水平居中 */align-items: center; /* 居中显示 */height: 100vh; /* 确保足够长,以便滚动 */font-size: 30px;color: #fff;background-image: -webkit-linear-gradient(125deg, #2c3e50, #27ae60, #2980b9, #e74c3c, #8e44ad); /* 渐变背景 */background-size: 400%;  /* 背景图大小 */animation: bgmove 10s infinite; /* 动画名称、持续时间、无限循环 */}/* 定义动画 */@keyframes bgmove {from {background-position: 0% 50%; /* 起始位置 */}50% {background-position: 100% 50%; /* 中间位置 */}to {background-position: 0% 50%; /* 结束位置,回到起始点形成循环效果 */}}</style>
</head>
<body><h1>Animate Background</h1>
</body>
</html>

 

2、逼真的水滴动图(通过改变元素的边框半径和阴影来实现动画。

<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>水滴动图</title><style>* {margin: 0;padding: 0;box-sizing: border-box;}body {width: 100vw;height: 100vh;display: flex;background-color: #00a8ff;justify-content: center;}/* 水面 */.water {margin-top: 200px;width: 300px;height: 300px;border: 1px solid #000;border-radius: 72% 28% 64% 36% / 12% 17% 83% 88%;box-shadow: inset 10px 20px 30px rgba(0, 0, 0, 0.5),10px 10px 20px rgba(0, 0, 0, 0.3),15px 15px 30px rgba(0, 0, 0, 0.05),inset -10px -10px 15px rgba(255, 255, 255, 0.8);  /* 阴影效果 */animation: move 5s linear infinite alternate; /* 动画效果  */}/* 水滴 */.water::after, .water::before {content: '';position: absolute;background-color: rgba(255, 255, 255, 0.8);}/* 水滴后 */.water::after {width: 20px;height: 20px;top: 240px;left: 47%;border-radius: 9% 91% 35% 65% / 51% 17% 83% 49%;}/* 水滴前 */.water::before {width: 10px;height: 10px;top: 230px;left: 45%;border-radius: 53% 47% 46% 54% / 99% 0% 100% 1%;}/* 动画效果 */@keyframes move {25% {border-radius: 11% 89% 65% 35% / 64% 32% 68% 36%;  /* 改变形状 */}50% {border-radius: 60% 40% 65% 35% / 64% 32% 68% 36%;  /* 改变形状 */}to {border-radius: 73% 27% 65% 35% / 64% 67% 33% 36%;}}</style>
</head>
<body><div class="water"></div>
</body>
</html>

3、热点图动画(通过逐渐放大和降低透明度的圆圈来表示热点的动态变化。

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>热点图动画</title><style>body {position: relative;background-color: coral;}/* 热点的位置,大小 颜色 */.beijing, .shanghai, .guangzhou {position: absolute;width: 40px;height: 10px;font-size: 12px;color: white;}/* 热点位置 */.beijing { top: 100px; left: 500px; }.shanghai { top: 250px; left: 550px; }.guangzhou { top: 350px; left: 480px; }/* 动画圆点大小,颜色,阴影 */.dot {width: 8px;height: 8px;background-color: deepskyblue;border-radius: 50%;box-shadow: 0 0 12px deepskyblue;}/* 动画圆点位置 */.bjdot, .shdot, .gzdot {position: absolute;}/* 圆点位置 */.bjdot { top: 105px; left: 485px; }.shdot { top: 255px; left: 535px; }.gzdot { top: 355px; left: 465px; }/* 动画圆点 */.dot div[class^="circle"] {position: absolute;transform: translate(-50%, -50%);margin-top: 4px;margin-left: 4px;width: 8px;height: 8px;border: 1px solid deepskyblue;box-sizing: border-box;border-radius: 50%;box-shadow: 0 0 12px deepskyblue;}/* 动画延迟时间 */.circle1 { animation: movie 3s linear infinite; }.circle2 { animation: movie 3s linear 1s infinite; }.circle3 { animation: movie 3s linear 2s infinite; }/* 动画 */@keyframes movie {0% {}70% {width: 60px;height: 60px;opacity: 0.3;}100% {width: 60px;height: 60px;opacity: 0;}}</style>
</head>
<body><div class="beijing">北京</div><div class="shanghai">上海</div><div class="guangzhou">杭州</div><div class="dot bjdot"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div></div><div class="dot shdot"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div></div><div class="dot gzdot"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div></div>
</body>
</html>

五、小结

     CSS3 动画是一种强大的工具,它允许开发者以简单而高效的方式为网页添加动画效果。通过掌握 @keyframes 规则和 animation 属性,您可以创建出丰富多样的动画效果,提升网页的用户体验。 

http://www.dtcms.com/wzjs/346774.html

相关文章:

  • 推荐企业手机网站建设手机怎么建网站
  • 海南做网站的公司广告公司职位
  • 在线装逼一键生成器免费seo推广软件
  • 学做卤菜网站环球资源网官方网站
  • 卖狗做网站什么关键词最好郑州网站关键词排名技术代理
  • 东莞网站建设+旅游百度推广登录平台客服
  • 网站运营的作用汕头网站推广排名
  • 国家企信网官网登录入口seo优化的内容有哪些
  • 竞猜网站建设班级优化大师下载安装
  • 北京住房和城乡建设部网站链接提取视频的网站
  • 高端网站制作公网络安全有名的培训学校
  • 男女做那个网站动态图整合营销传播最基础的形式是
  • 学习网页制作的网站seochinaz查询
  • 目前个人网站做地最好是哪几家今日国际新闻10条
  • 徐州网站开发公司快速排名优化seo
  • 做网站用到什么技术免费建网页
  • 怎样做免费商城网站网站制作出名的公司
  • 网站域名 过期免费建网站的步骤
  • 天津宇昊建设集团有限公司网站什么是网络营销含义
  • 网站制作的基本流程潍坊seo计费
  • 什么网站能免费做公众号封面怎么把平台推广出去
  • 长沙网站备案拍照点做一个网站要多少钱
  • 东莞松山湖最新疫情网络营销郑州优化推广公司
  • 专业的网站建设科技公司网站和网页的区别
  • 唐山网站从哪里找市场营销公司排名
  • 广东中高风险地区最新名单seo常用的工具
  • 有哪些公司网站建设比较好个人免费开发app
  • 如何做后端网站管理公司做网站怎么做
  • 网站开发一般学多久seo快排公司哪家好
  • 用ssh做的网站台州关键词优化推荐