svg+css实现天气预报时间线曲线效果代码
代码语言:html
所属分类:布局界面
代码描述:svg+css实现天气预报时间线曲线效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
background: #1881C4;
font-family: "pingfang SC", "helvetica neue", arial, "hiragino sans gb", "microsoft yahei ui", "microsoft yahei", simsun, sans-serif;
}
svg {
position: absolute;
z-index: 1;
left: 50%;
width: 2560px;
height: 300px;
top: 50%;
margin-left: -1280px;
margin-top: -150px;
}
</style>
</head>
<body >
<svg width="2560px" height="300px" viewBox="0 0 2560 300" xmlns="http://www.w3.org/2000/svg">
<!-- <path stroke="red" stroke-width="2" fill="#ddd" d=""/> -->
<script type="text/javascript">
var svgText = [
['08:00', '多云', '30°'],
['11:00', '晴', '31°'],
['14:00', '晴', '29°'],
['17:00', '晴', '28°'],
['21:00', '晴', '26°'],
['23:00', '晴', '28°'],
];
</script>
</svg>
<script>
// t: current time, b: begInnIng value, c: change In value, d: duration
var easing= {
def: 'easeOutQuad',
swing: function (t, b, c, d) {
//alert(easing.default);
return easing[easing.def](x, t, b, c, d);
},
easeInQuad: function (t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (t, b, c, d) {.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0