php 彩色标签插件,emlog彩色3D标签云 - 非插件

2024-01-18 07:50
文章标签 php 3d 彩色 插件 标签 emlog

本文主要是介绍php 彩色标签插件,emlog彩色3D标签云 - 非插件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

emlog彩色3D标签云 - 非插件

刘振兴

Emlog相关

2015年10月02日

11689

5条评论

刚才在emlog模板中心有款新出的模板,进入了作者的主页,看上了它那个侧边上的3D标签云,看上去还是很不错的,就给扒了下来

本人菜鸟一枚,各位大大请轻喷,下面是使用上的效果,也可以看我的侧边,已经启用的

c6f7cb59e30f4bd2e1aa47b5560f5bba.png

是不是看上去还不错,下面来讲下实现过程

首先是css样式部分

/*标签云*/

#tag_cloud_widget{position:relative;width:240px;height:240px;margin:10px auto 10px}

#tag_cloud_widget a{position:absolute;color:#fff;text-align:center;text-overflow:ellipsis;white-space:nowrap;top:0;left:0;padding:3px 5px;border:0}

#tag_cloud_widget a:hover{background:#d02f53;display:block}

#tag_cloud_widget a:nth-child(n){background:#666;border-radius:3px;display:inline-block;line-height:18px;margin:0 10px 15px 0}

#tag_cloud_widget a:nth-child(2n){background:#d1a601}

#tag_cloud_widget a:nth-child(3n){background:#286c4a}

#tag_cloud_widget a:nth-child(5n){background:#518ab2}

#tag_cloud_widget a:nth-child(4n){background:#c91d13}

然后是js部分

var radius = 100;

var d = 200;

var dtr = Math.PI / 180;

var mcList = [];

var lasta = 1;

var lastb = 1;

var distr = true;

var tspeed = 11;

var size = 200;

var mouseX = 0;

var mouseY = 10;

var howElliptical = 1;

var aA = null;

var oDiv = null;

window.onload = function() {

var i = 0;

var oTag = null;

oDiv = document.getElementById('tag_cloud_widget');

aA = oDiv.getElementsByTagName('a');

for (i = 0; i < aA.length; i++) {

oTag = {};

aA[i].onmouseover = (function(obj) {

return function() {

obj.on = true;

this.style.zIndex = 9999;

this.style.color = '#fff';

this.style.background = '#0099ff';

this.style.padding = '5px 5px';

this.style.filter = "alpha(opacity=100)";

this.style.opacity = 1

}

})(oTag) aA[i].onmouseout = (function(obj) {

return function() {

obj.on = false;

this.style.zIndex = obj.zIndex;

this.style.color = '#fff';

this.style.background = '#30899B';

this.style.padding = '5px';

this.style.filter = "alpha(opacity=" + 100 * obj.alpha + ")";

this.style.opacity = obj.alpha;

this.style.zIndex = obj.zIndex

}

})(oTag) oTag.offsetWidth = aA[i].offsetWidth;

oTag.offsetHeight = aA[i].offsetHeight;

mcList.push(oTag)

}

sineCosine(0, 0, 0);

positionAll(); (function() {

update();

setTimeout(arguments.callee, 40)

})()

};

function update() {

var a, b, c = 0;

a = (Math.min(Math.max( - mouseY, -size), size) / radius) * tspeed;

b = ( - Math.min(Math.max( - mouseX, -size), size) / radius) * tspeed;

lasta = a;

lastb = b;

if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) {

return

}

sineCosine(a, b, c);

for (var i = 0; i < mcList.length; i++) {

if (mcList[i].on) {

continue

}

var rx1 = mcList[i].cx;

var ry1 = mcList[i].cy * ca + mcList[i].cz * ( - sa);

var rz1 = mcList[i].cy * sa + mcList[i].cz * ca;

var rx2 = rx1 * cb + rz1 * sb;

var ry2 = ry1;

var rz2 = rx1 * ( - sb) + rz1 * cb;

var rx3 = rx2 * cc + ry2 * ( - sc);

var ry3 = rx2 * sc + ry2 * cc;

var rz3 = rz2;

mcList[i].cx = rx3;

mcList[i].cy = ry3;

mcList[i].cz = rz3;

per = d / (d + rz3);

mcList[i].x = (howElliptical * rx3 * per) - (howElliptical * 2);

mcList[i].y = ry3 * per;

mcList[i].scale = per;

var alpha = per;

alpha = (alpha - 0.6) * (10 / 6);

mcList[i].alpha = alpha * alpha * alpha - 0.2;

mcList[i].zIndex = Math.ceil(100 - Math.floor(mcList[i].cz))

}

doPosition()

}

function depthSort() {

var i = 0;

var aTmp = [];

for (i = 0; i < aA.length; i++) {

aTmp.push(aA[i])

}

aTmp.sort(function(vItem1, vItem2) {

if (vItem1.cz > vItem2.cz) {

return - 1

} else if (vItem1.cz < vItem2.cz) {

return 1

} else {

return 0

}

});

for (i = 0; i < aTmp.length; i++) {

aTmp[i].style.zIndex = i

}

}

function positionAll() {

var phi = 0;

var theta = 0;

var max = mcList.length;

for (var i = 0; i < max; i++) {

if (distr) {

phi = Math.acos( - 1 + (2 * (i + 1) - 1) / max);

theta = Math.sqrt(max * Math.PI) * phi

} else {

phi = Math.random() * (Math.PI);

theta = Math.random() * (2 * Math.PI)

}

mcList[i].cx = radius * Math.cos(theta) * Math.sin(phi);

mcList[i].cy = radius * Math.sin(theta) * Math.sin(phi);

mcList[i].cz = radius * Math.cos(phi);

aA[i].style.left = mcList[i].cx + oDiv.offsetWidth / 2 - mcList[i].offsetWidth / 2 + 'px';

aA[i].style.top = mcList[i].cy + oDiv.offsetHeight / 2 - mcList[i].offsetHeight / 2 + 'px'

}

}

function doPosition() {

var l = oDiv.offsetWidth / 2;

var t = oDiv.offsetHeight / 2;

for (var i = 0; i < mcList.length; i++) {

if (mcList[i].on) {

continue

}

var aAs = aA[i].style;

if (mcList[i].alpha > 0.1) {

if (aAs.display != '') aAs.display = ''

} else {

if (aAs.display != 'none') aAs.display = 'none';

continue

}

aAs.left = mcList[i].cx + l - mcList[i].offsetWidth / 2 + 'px';

aAs.top = mcList[i].cy + t - mcList[i].offsetHeight / 2 + 'px';

aAs.filter = "alpha(opacity=" + 100 * mcList[i].alpha + ")";

aAs.zIndex = mcList[i].zIndex;

aAs.opacity = mcList[i].alpha

}

}

function sineCosine(a, b, c) {

sa = Math.sin(a * dtr);

ca = Math.cos(a * dtr);

sb = Math.sin(b * dtr);

cb = Math.cos(b * dtr);

sc = Math.sin(c * dtr);

cc = Math.cos(c * dtr)

}

下面是php部分,修改module里的侧边标签方法

//3D标签云

function widget_tag($title){

global $CACHE;

$tag_cache = $CACHE->readCache('tags');?>

<?php echo $title;?>

<?php echo $value['tagname']; ?>

php函数可能和大家的有些不同,更具情况修改就行了,有什么问题可以QQ联系我,如果你最基础的都不会,那就别联系我了,先去看看教程

评论一下

赞助本站

版权申明:此文如未标注转载均为本站原创,自由转载请表明出处《IT技术宅》。

本文网址:https://www.ilt.me/emlog/33.html

这篇关于php 彩色标签插件,emlog彩色3D标签云 - 非插件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/618417

相关文章

maven中的maven-antrun-plugin插件示例详解

《maven中的maven-antrun-plugin插件示例详解》maven-antrun-plugin是Maven生态中一个强大的工具,尤其适合需要复用Ant脚本或实现复杂构建逻辑的场景... 目录1. 核心功能2. 典型使用场景3. 配置示例4. 关键配置项5. 优缺点分析6. 最佳实践7. 常见问题

使用Python和Tkinter实现html标签去除工具

《使用Python和Tkinter实现html标签去除工具》本文介绍用Python和Tkinter开发的HTML标签去除工具,支持去除HTML标签、转义实体并输出纯文本,提供图形界面操作及复制功能,需... 目录html 标签去除工具功能介绍创作过程1. 技术选型2. 核心实现逻辑3. 用户体验增强如何运行

MyBatis分页插件PageHelper深度解析与实践指南

《MyBatis分页插件PageHelper深度解析与实践指南》在数据库操作中,分页查询是最常见的需求之一,传统的分页方式通常有两种内存分页和SQL分页,MyBatis作为优秀的ORM框架,本身并未提... 目录1. 为什么需要分页插件?2. PageHelper简介3. PageHelper集成与配置3.

Maven 插件配置分层架构深度解析

《Maven插件配置分层架构深度解析》:本文主要介绍Maven插件配置分层架构深度解析,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录Maven 插件配置分层架构深度解析引言:当构建逻辑遇上复杂配置第一章 Maven插件配置的三重境界1.1 插件配置的拓扑

Idea插件MybatisX失效的问题解决

《Idea插件MybatisX失效的问题解决》:本文主要介绍Idea插件MybatisX失效的问题解决,详细的介绍了4种问题的解决方法,具有一定的参考价值,感兴趣的可以了解一下... 目录一、重启idea或者卸载重装MyBATis插件(无需多言)二、检查.XML文件与.Java(该文件后缀Idea可能会隐藏

Python使用Matplotlib绘制3D曲面图详解

《Python使用Matplotlib绘制3D曲面图详解》:本文主要介绍Python使用Matplotlib绘制3D曲面图,在Python中,使用Matplotlib库绘制3D曲面图可以通过mpl... 目录准备工作绘制简单的 3D 曲面图绘制 3D 曲面图添加线框和透明度控制图形视角Matplotlib

CSS去除a标签的下划线的几种方法

《CSS去除a标签的下划线的几种方法》本文给大家分享在CSS中,去除a标签(超链接)的下划线的几种方法,本文给大家介绍的非常详细,感兴趣的朋友一起看看吧... 在 css 中,去除a标签(超链接)的下划线主要有以下几种方法:使用text-decoration属性通用选择器设置:使用a标签选择器,将tex

MyBatis 动态 SQL 优化之标签的实战与技巧(常见用法)

《MyBatis动态SQL优化之标签的实战与技巧(常见用法)》本文通过详细的示例和实际应用场景,介绍了如何有效利用这些标签来优化MyBatis配置,提升开发效率,确保SQL的高效执行和安全性,感... 目录动态SQL详解一、动态SQL的核心概念1.1 什么是动态SQL?1.2 动态SQL的优点1.3 动态S

Python基于wxPython和FFmpeg开发一个视频标签工具

《Python基于wxPython和FFmpeg开发一个视频标签工具》在当今数字媒体时代,视频内容的管理和标记变得越来越重要,无论是研究人员需要对实验视频进行时间点标记,还是个人用户希望对家庭视频进行... 目录引言1. 应用概述2. 技术栈分析2.1 核心库和模块2.2 wxpython作为GUI选择的优

Maven pom.xml文件中build,plugin标签的使用小结

《Mavenpom.xml文件中build,plugin标签的使用小结》本文主要介绍了Mavenpom.xml文件中build,plugin标签的使用小结,文中通过示例代码介绍的非常详细,对大家的学... 目录<build> 标签Plugins插件<build> 标签<build> 标签是 pom.XML