TagCanvas - HTML5 Canvas Tag Cloud

http://www.goat1000.com/tagcanvas.php

TagCanvas是一个基于HTML5 Canvas技术开发的标签云动画。还提供一个以jQuery插件形式实现的版本。

它支持文本和图片两种格式,能够以Sphere, hcylinder 或 vcylinder三种形状显示。

TagCanvas还支持IE浏览器(利用ExplorerCanvas实现)。

具体参数:

OptionDefaultDescription
interval20Interval between animation frames, in milliseconds
maxSpeed0.05Maximum speed of rotation
minSpeed0.0Minimum speed of rotation when mouse leaves canvas
decel0.95Deceleration rate when mouse leaves canvas
minBrightness0.1Brightness of tags at farthest point (0.0-1.0)
textColour"#ff99ff"Colour of the tag text
textHeight15Height of the tag text font (in pixels)
textFont"Helvetica, Arial,
sans-serif"
Font family for the tag text
outlineColour"#ffff99"Colour of the box around the active tag
outlineThickness2Thickness of outline in pixels
outlineOffset5Distance of outline from text, in pixels
pulsateTo1.0Pulsate outline to this opacity (0.0-1.0)
pulsateTime3Pulse rate, in seconds per beat
depth0.5Controls the perspective (0.0-1.0)
initialnullInitial rotation, with horizontal and vertical as an array, e.g. [0.8,-0.3]. Values are multiplied by maxSpeed.
freezeActivefalseSet to true to pause movement when a tag is highlighted.
frontSelectfalseSet to true to prevent selection of tags at back of cloud.
txtOpttrueText optimisation, converts text tags to images for better performance.
txtScale2Scaling factor of text when converting to image in txtOpt mode.
reversefalseSet to true to reverse direction of movement relative to mouse position.
hideTagsfalseSet to true to automatically hide the tag list element if TagCanvas is started successfully.
zoom1.0Adjusts the relative size of the tag cloud in the canvas. Larger values will zoom into the cloud, smaller values will zoom out.
wheelZoomtrueEnables zooming the cloud in and out using the mouse wheel or scroll gesture.
zoomStep0.05The amount that the zoom is changed by with each movement of the mouse wheel.
zoomMax3.0Maximum zoom value.
zoomMin0.3Minimum zoom value.
shadow"#000000"Colour of the shadow behind each tag.
shadowBlur0Amount of tag shadow blurring, in pixels.
shadowOffset[0,0]X and Y offset of the tag shadow, in pixels.
weightfalseSet to true to turn on weighting of tags.
weightMode"size"Method to use for displaying tag weights. Should be one of size, colour or both.
weightSize1.0Multiplier for adjusting the size of tags when using a weight mode of size or both.
weightGradient{0:'#f00', 0.33:'#ff0',
0.66:'#0f0', 1:'#00f'}
The colour gradient used for colouring tags when using a weight mode of colour or both.
weightFromnullThe link attribute to take the tag weight from. The default of null means that the weight is taken from the calculated link font size.
shape"sphere"The shape of the cloud. Currently supported are sphere, hcylinder for a cylinder that starts off horizontal and vcylinder for a cylinder that starts off vertical.
locknullA value of "x" limits rotation of the cloud to the (horizontal) x-axis, and a value of "y" limits rotation to the (vertical) y-axis. (These are strings, so the quotes are required)


demo:

<!DOCTYPE html>
<html>
  <head>
  	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>TagCanvas example</title>
    <!--[if lt IE 9]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
    <script src="js/tagcanvas.min.js" type="text/javascript"></script>
    <script type="text/javascript">
		window.onload = function() {
			try {
				TagCanvas.Start('myTag','tags',{
				textColour: '#63cdff',
				outlineColour: '#63cdff',
				reverse: true,
				depth: 0.8,
				maxSpeed: 0.05
				});
			} catch(e) {
				document.getElementById('myCloudTag').style.display = 'none';
			}
		};
		function changeshape(s) {
			var locks = { hcylinder: 'x', vcylinder: 'y', hring: 'x', vring: 'y', sphere: '' };
			lock = locks[s] || '';
			shape = s;
			TagCanvas.initial = (lock == 'x' && [0,0.2]) || (lock == 'y' && [0.2,0]) || [0.2,0.2];
			restart();
		}
		changeshape('vcylinder')

    </script>
  </head>
  <body style="background:#000">
    <div id="myCloudTag">
      <canvas width="600" height="350" id="myTag">
        <p>Anything in here will be replaced on browsers that support the canvas element</p>
      </canvas>
    </div>
    <div id="tags">
      <ul>
        <li><a href="#" style="font-size:30px;">认证考试</a></li>
        <li><a href="#">UMTS OMSTAR </a></li>
        <li><a href="#">客户经理角色认知</a></li>
        <li><a href="#">PM角色</a></li>
        <li><a href="#">维修</a></li>
        <li><a href="#">信息安全</a></li>
        <li><a href="#">UMTS OMSTAR </a></li>
        <li><a href="#">客户经理角色认知</a></li>
        <li><a href="#">PM角色</a></li>
        <li><a href="#">维修</a></li>
      </ul>
    </div>
  </body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云飞扬扬

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值