模仿抖音数据排名交替动画效果
代码语言:html
所属分类:图表
代码描述:模仿抖音数据排名交替动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>排名特效</title>
<style>
body,html {
width: 100%;
height: 100%
}
.box {
width: 100%;
height: 40%;
margin: 30px;
}
.tbox {
width: 100%;
height: 100%;
border: 1px solid grey;
}
@-webkit-keyframes dowm {
from {
position: relative;
top: 0
}
to {
position: relative;
top: 50px
}}
@-webkit-keyframes up {
from {
position: relative;
top: 0
}
to {
position: relative;
top: -50px
}}
.dowm {
-webkit-animation: dowm 1s linear;
animation: dowm 1s linear;
-webkit-animation-fill-mode: both;
animation-fill-mode: both
}
.up {
-webkit-animation: up 1s linear;
animation: up 1s linear;
-webkit-animation-fill-mode: both;
animation-fill-mode: both
}
</style>
</head>
<body>
<div class="box">
<div class="tbox" id="tbox">
</div>
</div>
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
<script>; (function($) {
function getId(length) {
return Number(Math.random().toString().substr(3, length)+Date.now()).toString(36);
}
function compare(property) {
return function(a, b) {
var value1 = a[property]; var value2 = b[property]; return value2-value1;
}}
function EchartObj(element, option) {
this.element = element; this.$element = $(element)
this.domWidth = this.$element.width(); this.domHeight = this.$element.height(); this.option = option; this.data = option.data?option.data: []; this.dealData = this.data?this.data.sort(compare(1)): []; this.color = option.color?option.color: ["#8600FF", "#FF00FF", "#0000E3", "#F9F900", "#FF5809", "#00FFFF", "#B87070", "#A5A552", "#73BF00", "#00DB00"]; this.time = option.time?option.time: 30; this.arrObj = []; this.childrenHeight = this.domHeight/this.data.length; this.positionHeight = this.domHeight/(this.data.length+1); this.maxdata = ""; this.createBarobj(); this.monitorChange();
}
EchartObj.prototype = {
constructor: EchartObj, createBarobj: function() {
this.$element.css({
"position": "relative"
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0