2-23 关于animate动画库的学习?

2-23 关于animate动画库的学习?

关于这个动画库?

  1. 是在GitHub上找到的对应的代码库下载到本地

  2. 然后在HTML文档的head中添加引入对应的.css文件

  3. 在CSS文件的代码中找到对应需要的动画名称

  4. 添加到要实现动画的对象的类名上

  5. 是这个流程吗?但是感觉动画库很长要一个一个找过来不是会很麻烦?关于我按照官网的指引添加了动画名称,但是动画没有生效是什么原因?

  6. 相关代码:

  7. <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- 首先引入animate.css文件 -->
        <link rel="stylesheet" href="./CSS/animate.css-main/animate.min.css">
        <title>Document</title>
        <style>
            div {
                width: 200px;
                height: 200px;
                background-color: red;
                margin: 40px auto;
            }
        </style>
    </head>
    
    <body>
        <div class="animate__bounceInLeft"></div>
    </body>
    
    </html>

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
imooc_慕慕 2022-08-03 10:06:19

同学你好,可以用官网的这个在线链接,这样写是可以的,线上地址链接:

spacer.gifhttp://www.dowebok.com/demo/2014/98/animate.min.css

同学的步骤是可以的,在第五步的内容中可以直接在官网上找对应的动画名,参考如下图:

官网地址:https://www.jq22.com/yanshi819/

https://img1.sycdn.imooc.com//climg/62e9e30a09ed6fbf09090219.jpg

直接点击然后复制,类名中加上animated 再将类名复制到div中就可以了。

https://img1.sycdn.imooc.com//climg/62e9e220090e448104840090.jpg

同学可以再试试。

祝学习愉快~

  • 提问者 呜蜩的呀 #1

    按照老师的讲解修改了代码,但是依旧没有都动画效果出现,这是为什么呢?是在GitHub上下载了animation动画库的css文件引入后再操作的,是哪里有问题呢?


    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- 首先引入animate.css文件 -->
        <link rel="stylesheet" href="./CSS/animate.css-main/animate.min.css">
        <title>Document</title>
        <style>
            div {
                width: 200px;
                height: 200px;
                background-color: red;
                margin: 40px auto;
                animation-timeline: 10s;
            }
        </style>
    </head>
    
    <body>
        <!-- 在类名上加上对应的动画效果名称 写法要求是:animated 动画名称 -->
        <div class="animated bounceInLeft"></div>
    </body>
    
    </html>


    2022-08-08 14:06:08
  • imooc_慕慕 回复 提问者 呜蜩的呀 #2

    同学你好,上面给的地址是不需要添加前缀的,可以实现,猜测同学下载到本地的可能是最新版本,因此需要添加前缀,参考如下:

    https://img1.sycdn.imooc.com//climg/62f0e27d09678ba105660050.jpg

    <div class="animate__animated animate__bounceInLeft"></div>

    https://img1.sycdn.imooc.com//climg/62f0e0b109bf45e009750143.jpg

    可以再测试下,同时这个animation动画库存在兼容性,同学可以多在几个浏览器中试一试,

    祝学习愉快~

    2022-08-08 18:10:02
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师