d3实现文字蛇形动画效果

代码语言:html

所属分类:布局界面

代码描述:d3实现文字蛇形动画效果

代码标签: 蛇形 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
html {
  line-height: 1.15;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  font-family: "Lato", sans-serif;
}

body {
  margin: 0;
  overflow-x: hidden;
}

section {
  display: block;
}

svg {
  overflow: visible;
}

section {
  background-color: white;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 300;
}

#viz-word-snake {
  font-size: 14px;
  white-space: pre;
  cursor: default;
  width: 700px;
  margin: 0 auto;
}

.circle-path {
  fill: none;
  pointer-events: none;
}

.node .circle-background {
  fill: none;
  pointer-events: all;
  cursor: pointer;
}

.circle-center-translation {
  font-family: "Lato", sans-serif;
  font-size: 0.8em;
  font-weight: 400;
  text-anchor: middle;
  pointer-events: none;
}

.circle-center-original {
  font-family: "Dancing Script", cursive;
  font-size: 1.7em;
  text-anchor: middle;
  pointer-events: none;
}

.circle-center-language {
  font-family: "Lato", sans-serif;
  font-size: 0.8em;
  font-weight: 400;
  font-style: italic;
  text-anchor: middle;
  pointer-events: none;
}

.circle-path-legend {
  font-family: "Lato", sans-serif;
  font-size: 0.8em;
  pointer-events: none;
}

.circle-path-text {
  font-family: "Dancing Script", cursive;
  font-size: 1.1em;
  pointer-events: none;
}
</style>

</head>
<body translate="no">
<div id="viz-word-snake"></div>
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/d3.v5.js"></script>
<script >
var darkgrey = "#161616",
            middlegrey = "#a7a7a7",
            lightgrey = "#afafaf";

        var languageMap = [];
        languageMap["de"] = "German";
        languageMap["es"] = "Spanish";
        languageMap["fr"] = "French";
        languageMap["it"] = "Italian";
        languageMap["ja"] = "Japanese";
        languageMap["nl"] = "Dutch";
        languageMap["pl"] = "Polish";
        languageMap["pt"] = "Portuguese";
        languageMap["ru"] = "Russian";
        languageMap["tr"] = "Turkish";
        languageMap["all"] = "All languages";
        var divWidth = parseInt(d3.select("#viz-word-snake").style("width"));
        var margin = {
            top: 10,
            right: 10,
            bottom: 40,
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0