• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com专业计算机教程网站
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure
您的位置:首页 > 网页设计 >html5 > 超酷创意分段式SVG文字动画特效

超酷创意分段式SVG文字动画特效

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-03

本文主要包含分段式,SVG,文字动画等相关知识,匿名希望在学习及工作中可以帮助到您
简要教程

这是一款基于segment.js制作的非常有创意的分段式SVG文字动画特效。这个文字动画特效通过动画SVG的描边路径来制作各种文字的动画效果,效果非常的赞。

这个SVG文字动画特效的第一个DEMO中的最后几个例子使用了mo.js插件,一款由Oleg Solomka编写的用于制作网页图形动画的JavaScript库插件。通过mo.js,可以制作出效果更为震撼的文字动画效果。

417.GIF

特效中使用的字体是exquisite lowercase font,一套极富创意的WEB字体。

使用方法

要使用该SVG文字动画特效,要在页面中引入segment.js,它用于动画SVG路径,d3-ease,用于制作easing动画过渡效果,以及letters.js。

<script src="js/segment.js"></script>
<script src="js/d3-ease.v0.6.js"></script>                  
<script src="js/letters.js"></script>

HTML结构

可以使用一个<div>容器来包裹需要制作动画效果的文字。

<div class="my-text">my text</div>

初始化插件

然后我们就可以在JavaScript中获取这个元素,通过配置参数来制作绘制文字的动画。所有的参数选项(除了individualDelays)都可以设置为以下的值:

  • 单个值:可以被所有字母接收。

  • 数组:数组中的第一个元素会被第一个字母接收,第二个元素被第二个字母接收,以此类推。

下面是一个使用配置参数的例子:

// Selecting the container element
var el = document.querySelector('.my-text');
 
// All the possible options (these are the default values)
// Remember that every option (except individualDelays) can be defined as single value or array
var options = {
    size: 100,         // Font size, defined by the height of the letters (pixels)
    weight: 1,         // Font weight (pixels)
    rounded: false,    // Rounded letter endings
    color: '#5F6062',  // Font color
    duration: 1,       // Duration of the animation of each letter (seconds)
    delay: [0, 0.05],  // Delay animation among letters (seconds)
    fade: 0.5,         // Fade effect duration (seconds)
    easing: d3_ease.easeCubicInOut.ease,   // Easing function
    individualDelays: false,              
     // If false (default), every letter delay increase gradually, showing letters from left to right always. 
     If you want to show letters in a disorderly way, set it to true, and define different delays for the desired letters.
};
 
// Initializing the text (Letters parameters: container-element, options)
var myText = new Letters(el, options);

通过上面的配置,我们已经定义了文字显示和动画的选项,插件会在容器中生成SVG文字。默认情况下,文字是被隐藏的,如何触发文字动画,可以参看下面的方法。

// Show letters with the default options defined
myText.show();
 
// Hide letters with the default options defined
myText.hide();
 
// Toggle letters with the default options defined
myText.toggle();
 
// An example with all the possible options for triggers
// Parameters (JSON): duration, delay, fade, easing, individualDelays, callback
var newOptions = {
    duration: 2,
    delay: 0.2,
    fade: 1,
    easing: d3_ease.easeCircleInOut.ease,
    individualDelays: false,
    callback: function(){
        myText.hide();
    }
};
// These new options will override the options defined in the initialization
myText.show(newOptions);
 
// Show letters instantly, without any animation at all
// There is a hideInstantly and toggleInstantly function, too
myText.showInstantly();  // Shortcut for myText.show(0, 0, 0);

每一个SVG字母都被分配一个letter class类,例如:letter-(a, b, c, ...),以及letter-(1, 2, 3, ...)。通过这些class我们可以自定义字母的样式,例如设置margin值或定位方式等。

/* Setting margin among all letters */
.letter {
  margin: 0 10px;
}
 
/* Setting background to letter m */
.letter-m {
  background-color: lightsalmon;
}

以上就是超酷创意分段式SVG文字动画特效的内容,更多相关内容请关注微课江湖()!

您可能想查找下面的文章:

  • 超酷创意分段式SVG文字动画特效
  • 分段式基于SVG文字超酷创意动画特效

相关文章

  • 2018-12-03htm5新增的表单元素keygen标签的用法和属性介绍
  • 2018-12-03canvas实现动态小球重叠的效果代码
  • 2018-12-03HTML5使用DOM进行自定义控制示例代码_html5教程技巧
  • 2018-12-03html5跨域通信之postMessage
  • 2017-08-06简单介绍HTML5中audio标签的使用
  • 2018-12-03html5新增加的标签总结
  • 2018-12-03H5编辑器核心思想的实例分析
  • 2017-08-06HTML5 Canvas实现图片缩放、翻转、颜色渐变的代码示例
  • 2018-12-03h5canvas实现刮刮乐效果代码
  • 2017-08-06HTML5手机端弹出遮罩菜单特效代码

文章分类

  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure

最近更新的内容

    • HTML5实战与剖析之焦点管理(activeElement和hasFocus)
    • 有关提示操作的课程推荐9篇
    • 纯html5+css能写出什么惊人的效果?
    • HTML5中语义化 b 和 i 标签
    • 使用HTML5中的localStorage实现记住密码功能
    • canvas游戏开发学习之三:绘制复杂形状
    • 分享利用HTML5实现图片压缩上传的实例代码
    • html5 video.js 使用及兼容所有浏览器
    • 基于HTML5 Canvas 实现矢量工控风机叶轮旋转
    • Web前端面试题面试技巧有哪些?

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有