0.0.20 • Published 9 months ago

svg-3d-tag-cloud v0.0.20

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

SVG-3D-TAG-CLOUD

Create Stunning 3D Tag Clouds with SVG

Svg3dTagCloud is a lightweight and user-friendly JavaScript library that empowers you to generate visually appealing 3D tag clouds using SVG (Scalable Vector Graphics). It offers effortless integration into your web projects, delivering an engaging way to present keyword lists or other textual data.

Demo

Demo Demo

Features:

  • Simple & Effective: Effortlessly create tag clouds through a well-designed API.
  • Versatile Rendering: Supports both ES modules (ESM) and pure JavaScript script formats for broad compatibility.
  • Customizable Appearance: Tailor the visual style of your tag cloud with a range of configuration options.

Installation:

  1. Npm Url: https://www.npmjs.com/package/svg-3d-tag-cloud

  2. Install via NPM:

    • npm i svg-3d-tag-cloud
  3. Download Svg3dTagCloud:

    • Clone the repository from GitHub.
    • Alternatively, download the library files manually.
  4. Use CDN resource

    <script src="https://unpkg.com/svg-3d-tag-cloud/dist/SVG3DTagCloud.global.js"></script>

Usage (HTML + JavaScript):

  1. Version

    • window.SVG3DTagCloud.__VERSION
  2. ESM Import

    settings -> see #3

    import SVG3DTagCloud from 'svg-3d-tag-cloud';
    // other code
    
    // settings _> #2
    new SVG3DTagCloud(document.getElementById('container'), settings).build();
  3. Create HTML Structure:

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <title>SVG3DTagCloud Demo</title>
      </head>
      <body>
        <div id="container"></div>
        <script src="https://unpkg.com/svg-3d-tag-cloud/dist/SVG3DTagCloud.global.js"></script>
        <script>
          // ... your JavaScript code to create the tag cloud ...
        </script>
      </body>
    </html>
  4. Create the Tag Cloud:

    const childrenForText = [
      {
        label: 'JavaScript',
        url: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript',
        target: '_blank',
      },
      {
        label: 'HTML',
        url: 'https://developer.mozilla.org/en-US/docs/Web/HTML',
        target: '_blank',
      },
      // ... add more tag objects
    ];
    
    const childrenForImage = [
      {
        image: '/public/logo.svg', // Replace with your image path
        width: '50',
        height: '50',
        url: 'http://www.google.com',
        target: '_top',
        tooltip: 'Lorem ipsum',
      },
      // ... add more image objects
    ];
    
    let settings = {
      children: childrenForText || childrenForImage, // Choose between text or image tags
      width: 400, // default size
      height: 400,
      radius: '65%', // tag cloud radius percentage
      radiusMin: 75, // tag cloud min-radius px
      isDrawSvgBg: true,
      svgBgColor: 'black', // background color
      opacityOver: 1.0,
      opacityOut: 0.3,
      opacitySpeed: 6,
      fov: 800,
      speed: 0.1,
      fontFamily: 'Oswald, Arial, sans-serif',
      fontSize: '15',
      fontColor: '#fff',
      fontWeight: 'normal', // Customize font properties
      fontStyle: 'normal',
      fontStretch: 'narrower',
      fontToUpperCase: true,
      tooltipFontFamily: 'Oswald, Arial, sans-serif',
      tooltipFontSize: '12',
      tooltipFontColor: '#fff',
      tooltipFontWeight: 'normal',
      tooltipFontStyle: 'italic',
      tooltipFontStretch: 'normal',
      tooltipFontToUpperCase: false,
      tooltipTextAnchor: 'left',
      tooltipDiffX: 10,
      tooltipDiffY: 10,
      animatingSpeed: 0.01,
      animatingRadiusLimit: 1.3,
    };
    
    // Create and initialize the tag cloud
    new SVG3dTagCloud(document.getElementById('container'), settings).build();

Configuration Options (Attribute Table):

AttributeTypeDefaultDescription
childrenArray of SVG3DTagCloudChild[]An array of objects representing the tags to be displayed.
widthNumber400The width of the tag cloud in pixels.
heightNumber400The height of the tag cloud in pixels.
radiusNumber or string'65%'The radius of the tag cloud. Can be a pixel value or a percentage of the container size.
radiusMinNumber75The minimum radius of the tag cloud in pixels.
isDrawSvgBgBooleanfalseWhether to draw an SVG background.
svgBgColorString'#fff'The color of the SVG background.
opacityOverNumber1.0The opacity of the tag cloud when hovered over.
opacityOutNumber0.3The opacity of the tag cloud when not hovered over.
opacitySpeedNumber6The speed of opacity transition.
fovNumber800The field of view of the camera.
speedNumber0.1The rotation speed of the tag cloud.
fontFamilyString'Oswald, Arial, sans-serif'The font family to use for the tags.
fontSizeString'15'The font size of the tags.
fontColorString'#fff'The color of the tags.
fontWeightString'normal'The font weight of the tags.
fontStyleString'normal'The font style of the tags.
fontStretchString'narrower'The font stretch of the tags.
fontToUpperCaseBooleantrueWhether to convert tag text to uppercase.
tooltipFontFamilyString'Oswald, Arial, sans-serif'The font family for the tooltips.
tooltipFontSizeString'12'The font size for the tooltips.
tooltipFontColorString'#fff'The color of the tooltips.
tooltipFontWeightString'normal'The font weight for the tooltips.
tooltipFontStyleString'italic'The font style for the tooltips.
tooltipFontStretchString'normal'The font stretch for the tooltips.
tooltipFontToUpperCaseBooleanfalseWhether to convert tooltip text to uppercase.
tooltipTextAnchorString'left'The text anchor for the tooltips.
tooltipDiffXNumber10The horizontal offset for the tooltips.
tooltipDiffYNumber10The vertical offset for the tooltips.
animatingSpeedNumber0.01The animation speed.
animatingRadiusLimitNumber1.3The maximum radius for the animation.

Project running

  git clone https://github.com/Appigle/svg3dtagcloud.git
  npm install
  npm run dev
  npm run build_cp
  npm login
  npm run lib-publish  # publish to npm

License

MIT

Thanks

Niklas Knaack

0.0.20

9 months ago

0.0.19

9 months ago

0.0.18

9 months ago

0.0.17

9 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

9 months ago

0.0.13

9 months ago

0.0.12

9 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago