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

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

微信图片_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>
目录
相关文章
|
传感器 人工智能 物联网
带你了解热门IoT开源项目:home assistant
home assistant是一个基于python的家庭智能化平台,可运行于本地服务器,或者树莓派上。利用该平台,可以统一控制家庭中所有的智能设备。
带你了解热门IoT开源项目:home assistant
|
程序员 网络安全 开发工具
git介绍,安装(手把手),命令与使用(包含IDEA操作,github,gitee的万字图文详述)(三)
git介绍,安装(手把手),命令与使用(包含IDEA操作,github,gitee的万字图文详述)
510 0
git介绍,安装(手把手),命令与使用(包含IDEA操作,github,gitee的万字图文详述)(三)
|
Web App开发 人工智能 数据可视化
猫头虎 推荐:国产开源AI工具 爱派(AiPy)|支持本地部署、自动化操作本地文件的AI办公神器
爱派(AiPy)是一款国产开源AI工具,支持本地部署与自动化操作,助力数据处理与办公效率提升。基于Python Use理念,AiPy让AI直接控制本地文件,简化繁琐任务,提供高效智能的解决方案,适用于数据工程师、分析师及日常办公用户。
6113 0
|
安全 Android开发 数据安全/隐私保护
探索Android应用开发的新趋势
随着技术的不断进步,Android应用开发领域也在经历着翻天覆地的变化。从Kotlin的崛起到Flutter的流行,再到Jetpack Compose的创新,开发者们正面临着前所未有的机遇和挑战。本文将深入探讨这些新兴技术如何影响当前的开发实践,并预测它们将如何塑造未来的移动应用开发。 【7月更文挑战第26天】
408 3
|
量子技术
量子物理是什么?
【5月更文挑战第20天】量子物理是什么?
1418 1
|
XML 存储 安全
软件体系结构 - 需求规格说明书
软件体系结构 - 需求规格说明书
2448 0
|
JavaScript 固态存储 Devops
Github Actions 实现 Node.js 项目的 CICD 环境搭建
本文我们介绍 CI / CD 的概念, 主要是帮助完成软件开发的自动化构建、测试和发布环节。同时会使用 Gtihub Actions 实现一个 Node.js 项目的自动化部署环境的搭建。
2226 0
|
存储 C语言
【c语言指针详解】指针的高级应用
【c语言指针详解】指针的高级应用
525 0
|
存储 测试技术 开发工具
|
存储 PHP
PHP的define 与 const区别是什么?底层原理是什么?
PHP的define 与 const区别是什么?底层原理是什么?
383 0