词云图,随便用,做个备份

简介: 词云图,随便用,做个备份

微信图片_20220926143414.gif

代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<style id="webmakerstyle">
body {
  width: 100vw;
  height: 100vh;
  text-align: center; }
#root {
  width: 100%;
  height: 100%;
  display: flex; }
.ball-bg {
  margin: auto;
  width: 300px;
  height: 300px; }
  .ball-bg .container {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    perspective: 1000;
    animation: fullrotate 10s linear infinite; }
    .ball-bg .container .point {
      position: absolute;
      top: 50%;
      left: 49%;
      transition: transform 2s;
      font-size: 40px; }
    .ball-bg .container.plan {
      animation: unset; }
      .ball-bg .container.plan .point {
        transition: transform .6s;
        font-size: 16px;
        cursor: pointer; }
        .ball-bg .container.plan .point:hover {
          border-bottom: 1px solid #808080; }
    .ball-bg .container.columnar {
      animation: full-columnar 10s linear infinite; }
@keyframes fullrotate {
  to {
    transform: rotateY(360deg) rotateZ(360deg); } }
@keyframes full-columnar {
  to {
    transform: rotateY(360deg); } }
</style>
</head>
<body>
<div id="root">
  <div class="ball-bg">
    <div
      :class="`container ${shape}`"
      ref="coin"
      @mouseenter="shape = 'plan';"
      @mouseleave="mouseLeave"
      >
      <div
       class="point"
       v-for="(item, idx) in tags"
       :key="idx"
       :style="item.style"
      >{{ item.text }}</div>
    </div>
  </div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"></script>
<script src="chrome-extension://lkfkkhfhhdkiemehlpkgjeojomhpccnh/lib/transpilers/babel-polyfill.min.js"></script><script>
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var app = new Vue({
  el: '#root',
  data: {
    shapes: ['plan', 'ball', 'columnar'],
    shape: 'columnar',
    oldShape: 'columnar',
    tags: [],
    width: 200
  },
  watch: {
    shape: function shape(val, old) {
      this.oldShape = old;
      this.deformation(val);
    }
  },
  methods: {
    deformation: function deformation(type) {
      var _this = this;
      var len = this.tags.length;
      var func = null;
      var random = function random() {
        var min = arguments[0] || 0;
        var max = arguments[1] || 0;
        if (max < min) {
          var _ref = [max, min];
          min = _ref[0];
          max = _ref[1];
        }
        return Math.random() * max + min;
      };
      if (type === 'plan') {
        func = function func(i) {
          var r = 0;
          var d = i % 2 === 0 ? 1 : -1;
          var rx = 0;
          var ry = (parseInt(i / 2) + 1) * 25 * d;
          var style = '';
          style += 'transform: translateX(' + rx + 'px) translateY(' + ry + 'px);';
          style += 'color: rgba(' + random(200) + ', ' + random(200) + ', ' + random(200) + ', 1);';
          return { style: style };
        };
      }
      // 测试
      if (type === 'ball') {
        func = function func(i) {
          var r = _this.width / 2;
          var rx = random(360);
          var ry = random(360);
          var style = '';
          style += 'transform: rotateY(' + ry + 'deg) rotateX(' + rx + 'deg) translateZ(' + r + 'px);';
          style += 'color: rgba(' + random(200) + ', ' + random(200) + ', ' + random(200) + ', 1);';
          return { style: style };
        };
      }
      // 柱状
      if (type === 'columnar') {
        func = function func(i) {
          var r = _this.width / 2;
          var d = i % 2 === 0 ? 1 : -1;
          var rx = 0;
          var ry = 360 / 5 * i;
          var ty = i * 10 * d;
          var style = '';
          style += 'transform: translateY(' + ty + 'px) rotateY(' + ry + 'deg) rotateX(' + rx + 'deg) translateZ(' + r + 'px);';
          style += 'color: rgba(' + random(200) + ', ' + random(200) + ', ' + random(200) + ', 1);';
          return { style: style };
        };
      }
      this.tags = [].concat(_toConsumableArray(this.tags)).map(function (item, idx) {
        return _extends({}, item, func(idx));
      });
    },
    /**
     * 鼠标离开容器的方法
     * 改变动画的形式
    */
    mouseLeave: function mouseLeave() {
      var i = this.shapes.indexOf(this.oldShape);
      if (this.shapes[i + 1]) {
        this.shape = this.shapes[i + 1];
      } else {
        this.shape = this.shapes[1];
      }
    }
  },
  created: function created() {
    // this.shape(['ball', 'infinite'], 0)
    // this.shape(['infinite'], 0)
    this.tags = [{ text: '疫情', style: '' }, { text: '新冠', style: '' }, { text: '上海', style: '' }, { text: '抗疫', style: '' }, { text: '病毒', style: '' }, { text: '坠机', style: '' }, { text: '乌克兰', style: '' }, { text: '俄罗斯', style: '' }, { text: '生物实验室', style: '' }, { text: '制裁', style: '' }, { text: '严峻', style: '' }, { text: '奥密克戎', style: '' }];
  },
  mounted: function mounted() {
    this.width = +this.$refs.coin.clientWidth;
    this.deformation('columnar');
  }
});
//# sourceURL=userscript.js
</script>
</body>
</html>
目录
相关文章
|
10月前
wps插入图片显示不全、混乱
wps插入图片显示不全、混乱
89 0
|
10月前
|
数据可视化
新建论文三线表模板,一键格式刷(包含word和latex版本)
新建论文三线表模板,一键格式刷(包含word和latex版本)
567 0
|
机器学习/深度学习 监控 算法
绘制森林资源图的工具介绍
绘制森林资源图的工具介绍
120 0
绘制森林资源图的工具介绍
PPT - 双屏幕情况下,如何设置 PPT 不在主屏幕显示问题?
PPT - 双屏幕情况下,如何设置 PPT 不在主屏幕显示问题?
525 0
PPT - 双屏幕情况下,如何设置 PPT 不在主屏幕显示问题?
关于 chm帮助文档右边内容区域无法显示 的解决方法
关于 chm帮助文档右边内容区域无法显示 的解决方法
关于 chm帮助文档右边内容区域无法显示 的解决方法
|
存储 数据可视化
R可视乎|创建乐高版马赛克图
今日内容比较“无用”,觉得比较好玩,所以就做一期“异类”可视化啦!主要介绍下 brickr[1] 包,它将乐高(LEGO) 带入 R 和 tidyverse 生态系统中,该包分为2个部分: • Mosaics(马赛克)[2]:将图像转换为乐高积木的马赛克图像。 • 3D 模型[3]:使用 rgl 包,通过数据表构建 3D 乐高模型。 今天这一期主要介绍第一个部分:
155 0
R可视乎|创建乐高版马赛克图
|
存储 C#
C#修改电脑桌面图
C#修改电脑桌面图
133 0
|
应用服务中间件 nginx Linux
|
开发工具
VIM编辑器操作小抄图
从网上找到一张vim使用图,这里分享出来 初学vim,可以将此图设为桌面背景,哈哈哈 vim小抄.png 如涉侵权,尽快删除
1927 0