基于jquery和svg实现超炫酷的动画特效


Posted in Javascript onDecember 09, 2014

今天给大家分享一款基于jquery和svg超炫的网页动画。这款动画效果非常炫。下面还有重播、慢速、和反向动画按钮。效果非常漂亮。一起看下效果图:

基于jquery和svg实现超炫酷的动画特效

实现的代码。

html代码:

 <div id="intro">

        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"

            version="1.1" id="ihtLogo" x="0" y="0" viewbox="0 0 308.8 152.1" xml:space="preserve"

            enable-background="new 0 0 308.8 152.1">

    <style>

        .tomatoLeft, .tomatoRight

        {

            fill: #D74022;

        }

        .bracketLeft, .bracketRight

        {

            fill: #4D4D4F;

        }

        .s2

        {

            fill: none;

            stroke-linecap: round;

            stroke-miterlimit: 10;

            stroke-width: 10;

            stroke: #FFF;

        }

        .tomatoLeaves

        {

            fill: #95D600;

        }

    </style>  

    <polygon points="238.3 152.1 225.6 139.3 283.4 81.5 225.6 23.8 238.3 11 308.8 81.5 " class="bracketRight"/>

    <polygon points="70.5 152.1 0 81.5 70.5 11 83.2 23.8 25.5 81.5 83.2 139.3 " class="bracketLeft"/>

    <g id="tomato">

      <path d="M139.7 17.2C106 18.3 78.6 45.7 77.5 79.4 76.9 98 84.2 114.9 96.3 127l91-91C175.2 23.9 158.3 16.6 139.7 17.2z" class="tomatoLeft"/>

      <path d="M122.3 127c12.1 12.1 29 19.4 47.6 18.8 33.7-1.1 61.1-28.5 62.2-62.2 0.6-18.6-6.7-35.5-18.8-47.6L122.3 127z" class="tomatoRight"/>

      <path d="M128.6 10.9c0-1.5 0-3 0.1-4.5 0.1-1.4 0.8-3.1 0.3-4.5 -0.8-2.5-4.3-2.6-5.5-0.3 -1.8 4.5-2.5 9.2-2.4 14 -6.7 3.2-17 2-24-0.2 5.1 4 11.2 6.7 18 7.5 -6.5 3-12.5 7-17.6 11.9 13.7-9.2 32.4-7.6 44.4 3.7 -1.3-4.6-3.5-8.7-6.4-12.3 7.3-5.2 16.3-7.4 25.1-6.3 -7-2.1-14.2-3-21.5-2.8 3.2-2.1 6-4.7 8.3-7.7 -6.3 3.5-11.4 4.1-18.5 4.4C128.8 13.2 128.7 11.6 128.6 10.9" class="tomatoLeaves"/>

    </g>

  </svg>

        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"

            version="1.1" id="ihtText" x="0" y="0" viewbox="0 0 148.2 23" enable-background="new 0 0 148.2 23"

            xml:space="preserve">

    <path fill="#D74022" d="M5.3 18.5V19H3.7h-1H1.1v-0.4c0-0.2 0.1-0.4 0.4-0.4 0 0 0.1 0 0.1 0 0.1 0 0.2 0 0.4 0 0.2 0 0.4 0 0.7 0V8.9c-0.2 0-0.4 0-0.5 0 -0.2 0-0.3 0-0.3 0 -0.1 0-0.1 0-0.2 0 0 0-0.1 0-0.1 0 -0.3 0-0.4-0.1-0.4-0.4V8h1.6 1v10.1c0.2 0 0.4 0 0.5 0 0.2 0 0.3 0 0.3 0 0.1 0 0.1 0 0.2 0 0 0 0.1 0 0.1 0C5.2 18.1 5.3 18.3 5.3 18.5zM2.3 4.6C2.3 4.5 2.2 4.4 2.2 4.2c0-0.1 0-0.3 0.1-0.4 0.1-0.1 0.1-0.2 0.2-0.3 0.1-0.1 0.2-0.2 0.3-0.2s0.2-0.1 0.4-0.1c0.1 0 0.3 0 0.4 0.1 0.1 0.1 0.2 0.1 0.3 0.2C4 3.6 4.1 3.7 4.1 3.9 4.2 4 4.2 4.1 4.2 4.2c0 0.1 0 0.3-0.1 0.4C4.1 4.7 4 4.8 3.9 4.9 3.8 5 3.7 5.1 3.6 5.1 3.5 5.2 3.3 5.2 3.2 5.2c-0.1 0-0.3 0-0.4-0.1S2.6 5 2.5 4.9 2.4 4.7 2.3 4.6z"/>

    <path fill="#D74022" d="M14.9 7.6c1.2 0 2.1 0.4 2.8 1.2 0.6 0.8 1 1.8 1 3.1v5.5c0.7 0.1 1.1 0.2 1.3 0.3 0.2 0 0.3 0.2 0.3 0.4V19h-3.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.3-0.9 0.6-1.4 0.8 -0.6 0.2-1.2 0.3-1.9 0.3 -1.4 0-2.8-0.3-3.6-0.6v0 -1.1 -2.1h0.1 0.3 0.9c0.3 0 0.5 0.1 0.5 0.4 0 0.1 0.1 0.4 0.1 1.3 0.6 0.2 1.3 0.2 1.8 0.2 0.3 0 0.6 0 0.8-0.1 0.2-0.1 0.4-0.2 0.6-0.3 0.2-0.1 0.3-0.3 0.3-0.4 0.1-0.2 0.1-0.3 0.1-0.5 0-0.3-0.1-0.5-0.2-0.6 -0.2-0.2-0.4-0.3-0.6-0.4 -0.3-0.1-0.6-0.2-0.9-0.3 -0.3-0.1-0.7-0.2-1-0.3 -0.3-0.1-0.7-0.3-1-0.4 -0.3-0.2-0.6-0.4-0.9-0.6 -0.3-0.2-0.5-0.5-0.6-0.9 -0.2-0.4-0.2-0.8-0.2-1.3 0-0.5 0.1-0.9 0.3-1.3s0.5-0.8 0.8-1.1c0.4-0.3 0.8-0.6 1.3-0.7s1.1-0.3 1.8-0.3c1.1 0 1.7 0.1 3.3 0.6v0 3.2h-0.1 -0.3 -0.9c-0.3 0-0.5-0.1-0.5-0.4 0-0.1-0.1-0.4-0.1-1.2 -0.3-0.1-0.8-0.1-1.3-0.1 -0.5 0-1 0.1-1.3 0.3 -0.3 0.2-0.5 0.5-0.5 0.9 0 0.2 0.1 0.4 0.2 0.6 0.2 0.2 0.4 0.3 0.6 0.4 0.3 0.1 0.6 0.2 0.9 0.3 0.3 0.1 0.7 0.2 1 0.3 0.3 0.1 0.7 0.3 1 0.4s0.6 0.3 0.9 0.6c0.3 0.2 0.5 0.5 0.6 0.8C146.9 14.5 147 14.9 147 15.4z"/>

  </svg>

        <ul class="buttons">

            <li><a id="btnPlay" class="button" href="#">replay</a></li>

            <li><a id="btnSlowMo" class="button" href="#">slow motion</a></li>

            <li><a id="btnReverse" class="button" href="#">reverse</a></li>

        </ul>

    </div>

    <script src='jquery.js'></script>

    <script src='TweenMax.min.js'></script>

    <script>

        var tomato = $('#tomato'), bracketRight = $('.bracketRight'), bracketLeft = $('.bracketLeft'), tomatoLeft = $('.tomatoLeft'), tomatoRight = $('.tomatoRight'), tomatoLeaves = $('.tomatoLeaves'), letters = $('#ihtText path'), $btnPlay = $('#btnPlay'), $btnSlowMo = $('#btnSlowMo'), $btnReverse = $('#btnReverse'), tl;

        tl = new TimelineMax();

        tl.set([tomatoLeft], { xPercent: 23.6 });

        tl.set([tomatoLeaves], { xPercent: 41 });

        tl.set([tomato], {

            xPercent: 2,

            rotation: 13,

            transformOrigin: 'center center'

        });

        tl.set(tomato, { yPercent: -200 });

        tl.set(bracketRight, { xPercent: 200 });

        tl.set(bracketLeft, { xPercent: -200 });

        tl.to([

    bracketRight,

    bracketLeft

], 0.3, {

    xPercent: 0,

    ease: Power4.easeOut

}, 0.5).to(tomato, 0.5, {

    yPercent: 0,

    ease: Bounce.easeOut

}).to(tomato, 0.2, {

    rotation: 0,

    xPercent: -4

}).to([

    tomatoLeft,

    tomatoLeaves

], 0.2, { xPercent: 0 }, 'split').to(tomato, 0.2, {

    rotation: 0,

    xPercent: 0

}, 'split').to(tomatoRight, 0.2, { xPercent: 2 }, 'split').staggerFrom(letters, 0.01, { autoAlpha: 0 }, 0.03).add('end');

        $btnPlay.click(function () {

            tl.timeScale(1).seek(0);

        });

        $btnSlowMo.click(function () {

            tl.timeScale(0.2).seek(0.5);

        });

        $btnReverse.click(function () {

            tl.timeScale(1).seek('end').reverse();

        });

        //@ sourceURL=pen.js

    </script>

css代码:

 #intro

        {

            height: 100vh;

            width: 50%;

            margin: 0 auto;

            overflow: hidden;

        }

        #intro #ihtLogo

        {

            position: absolute;

            top: 50%;

            left: 50%;

            height: 100%;

            width: 50%;

            transform: translate(-50%, -70%);

        }

        #intro #ihtText

        {

            width: 100%;

            position: absolute;

            top: 50%;

            width: 40%;

            left: 50%;

            transform: translate(-50%, 80%);

        }

        .buttons

        {

            position: absolute;

            bottom: 20px;

            left: 20px;

            list-style: none;

            margin: 0;

            padding: 0;

            right: 20px;

        }

        .button

        {

            float: left;

            margin-right: 10px;

            padding: 10px 15px;

            border: 1px #ebebeb solid;

            text-decoration: none;

            color: #222222;

        }
Javascript 相关文章推荐
return false,对阻止事件默认动作的一些测试代码
Nov 17 Javascript
最短的javascript:地址栏载入脚本代码
Oct 13 Javascript
JavaScript可否多线程? 深入理解JavaScript定时机制
May 23 Javascript
JS批量修改PS中图层名称的方法
Jan 26 Javascript
JS实现的论坛Ajax打分效果完整实例
Oct 31 Javascript
jQuery实现的导航动画效果(附demo源码)
Apr 01 Javascript
简单实现jQuery多选框功能
Jan 09 Javascript
Vue 仿QQ左滑删除组件功能
Mar 12 Javascript
vue App.vue中的公共组件改变值触发其他组件或.vue页面监听
May 31 Javascript
在Layui中实现开关按钮的效果实例
Sep 29 Javascript
基于JavaScript的数据结构队列动画实现示例解析
Aug 06 Javascript
vue-router中hash模式与history模式的区别
Jun 23 Vue.js
Javascript实现禁止输入中文或英文的例子
Dec 09 #Javascript
JavaScript解析json格式数据简单示例
Dec 09 #Javascript
浅谈页面装载js及性能分析方法
Dec 09 #Javascript
深入分析jquery解析json数据
Dec 09 #Javascript
WEB前端设计师常用工具集锦
Dec 09 #Javascript
13 款最热门的 jQuery 图像 360 度旋转插件推荐
Dec 09 #Javascript
JQuery中使用on方法绑定hover事件实例
Dec 09 #Javascript
You might like
GD输出汉字的函数的分析
2006/10/09 PHP
深入理解ob_flush和flush的区别(ob_flush()与flush()使用方法)
2013/02/06 PHP
基于PHP异步执行的常用方式详解
2013/06/03 PHP
CI框架中通过hook的方式实现简单的权限控制
2015/01/07 PHP
php文件夹的创建与删除方法
2015/01/24 PHP
PHP模型Model类封装数据库操作示例
2019/03/14 PHP
Laravel 将数据表的数据导出,并生成seeds种子文件的方法
2019/10/09 PHP
javascript 带有滚动条的表格,标题固定,带排序功能.
2009/11/13 Javascript
javaScript 计算两个日期的天数相差(示例代码)
2013/12/27 Javascript
javascript引用赋值(地址传值)用法实例
2015/01/13 Javascript
javascript与css3动画结合使用小结
2015/03/11 Javascript
JavaScript实现仿新浪微博大厅和腾讯微博首页滚动特效源码
2015/09/15 Javascript
js实现模拟银行卡账号输入显示效果
2015/11/18 Javascript
js仿支付宝填写支付密码效果实现多方框输入密码
2016/03/09 Javascript
JS中常用的正则表达式
2016/09/29 Javascript
JavaScript组成、引入、输出、运算符基础知识讲解
2016/12/08 Javascript
js微信支付实现代码
2016/12/22 Javascript
Vue实现简易翻页效果源码分享
2018/11/08 Javascript
利用JavaScript为句子加标题的3种方法示例
2021/01/05 Javascript
[00:43]DOTA2小紫本全民票选福利PA至宝全方位展示
2014/11/25 DOTA
[49:13]DOTA2上海特级锦标赛C组资格赛#1 OG VS LGD第一局
2016/02/27 DOTA
[04:22]DOTA2上海特级锦标赛主赛事第四日TOP10
2016/03/06 DOTA
对python3 urllib包与http包的使用详解
2018/05/10 Python
python使用xlsxwriter实现有向无环图到Excel的转换
2018/12/12 Python
Pytorch 的损失函数Loss function使用详解
2020/01/02 Python
把Anaconda中的环境导入到Pycharm里面的方法步骤
2020/10/30 Python
css3强大的动画效果animate使用说明及浏览器兼容介绍
2013/01/09 HTML / CSS
深入浅析HTML5中的article和section的区别
2018/05/15 HTML / CSS
美国名牌太阳镜折扣网站:Eyedictive
2017/05/15 全球购物
ECCO俄罗斯官网:北欧丹麦鞋履及皮具品牌
2020/06/26 全球购物
医院搬迁方案
2014/06/14 职场文书
校庆标语集锦
2014/06/25 职场文书
2014最新自愿离婚协议书范本
2014/11/19 职场文书
台风停课通知
2015/04/24 职场文书
2015年科研工作总结范文
2015/05/13 职场文书
mysql 生成连续日期及变量赋值
2022/03/20 MySQL