js 怎么让文字做 圆周运动 js 怎么让文字做 圆周运动 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先定义一个轨迹,然后每一个字都作为一个div,在这个轨迹上走,并旋转 var step = 1; var r = 50; window.setInterval(function () { if (step == 360) { step = 1; } document.getElementById("tt").style.left = 300 + r * Math.sin(step); document.getElementById("tt").style.top = 200 + r * Math.cos(step); step += 0.05; }, 1); <div id='testDiv' style="top:70px;left:500px;position:absolute;width:400px;height:50px"></div><script language='javascript' type="text/javascript"> Phrase="2010五月的鲜花全国大学生文艺演出舞美设计";Balises="";Taille=12; // 40 Midx=200;Decal=0.28;Nb=Phrase.length;y=-10000;Alpha=5;I_Alpha=0.05; var isIE=false;function init(){ if(Phrase==""){ return;} for (x=0;x<Nb;x++){ Balises=Balises + '<DIV Id=L' + x + ' STYLE="width:25px;height:25px;font-family:黑体;position:absolute;font-weight:bold;top:30px;left:' +(100+x*15) + 'px;z-index:0">' + Phrase.charAt(x) + '</DIV>' } document.getElementById('testDiv').innerHTML = Balises; if(navigator.userAgent.indexOf("MSIE")>0) { isIE=true; } TimeFontView=window.setTimeout("Alors()",150);}function Alors(){ Alpha=Alpha-I_Alpha; for (x=0;x<Nb;x++){ Alpha1=Alpha+Decal*x; Cosine=Math.cos(Alpha1); Ob=document.getElementById("L"+x); Ob.style.left=(Midx+100*Math.sin(Alpha1)) +"px"; Ob.style.zIndex=20*Cosine + 50; Ob.style.fontSize=(Taille+5*Cosine +8) +"px"; //Ob.style.fontSize=Taille+25*Cosine; //Ob.style.color="rgb("+ (Cosine*80 +77) + ","+ (Cosine*80+177) + ",50)"; if(isIE) Ob.style.color="rgb(255,"+ (Cosine*150 + 105) + ","+(Cosine*60)+")"; else Ob.style.color = convert(255, (Cosine*150 + 105) ,(Cosine*60)); } TimeFontView=window.setTimeout("Alors()",150);}function getRgb(rgb){ var rgbArr = []; var newRgb = ""; var r,g,b; var color = ""; if(rgb.indexOf("rgb")!=-1){ newRgb = rgb.substring(4,rgb.length-1); rgbArr = newRgb.split(","); if(rgbArr.length>2){ r = rgbArr[0]; g = rgbArr[1]; b = rgbArr[2]; } } return convert(r,g,b); } function toHex(N){ N=Math.max(0,N) N=Math.min(255,N) return "0123456789ABCDEF".charAt((N-N%16)/16) + "0123456789ABCDEF".charAt(N%16) }function convert(R,G,B) { R=Math.max(0,R) R=Math.min(255,R) G=Math.max(0,G) G=Math.min(255,G) B=Math.max(0,B) B=Math.min(255,B) var color="#"+this.toHex(R)+this.toHex(G)+this.toHex(B); return color; }init();</script> hch126163(老胡)我是说 像钟表那样 的运动轨迹 而不是 那种向里滚动 我在chrome浏览器获取元素坐标出错,谁能帮我? JavaScript链接数据库出错 js 焦点获得和失去问题 JS如何读写文件 js或jquery,在线等 怎样将jsp上一页的信息数据带到即将要跳转的页面 关于三维数组的长度 急,在线等待~~~~~~~~~~~~~~~~~~~ 再求Ie5.0中<iframe>遮挡<div>的解决方案! 修改问题。 谁懂正则,帮我看看,这个为什么不起作用... javascript 事件处理 概念不懂
var step = 1;
var r = 50;
window.setInterval(function () {
if (step == 360) {
step = 1;
}
document.getElementById("tt").style.left = 300 + r * Math.sin(step);
document.getElementById("tt").style.top = 200 + r * Math.cos(step); step += 0.05;
}, 1);
Phrase="2010五月的鲜花全国大学生文艺演出舞美设计";
Balises="";
Taille=12; // 40
Midx=200;
Decal=0.28;
Nb=Phrase.length;
y=-10000;
Alpha=5;
I_Alpha=0.05;
var isIE=false;
function init(){
if(Phrase=="")
{
return;}
for (x=0;x<Nb;x++){
Balises=Balises + '<DIV Id=L' + x + ' STYLE="width:25px;height:25px;font-family:黑体;position:absolute;font-weight:bold;top:30px;left:' +(100+x*15) + 'px;z-index:0">'
+ Phrase.charAt(x) + '</DIV>'
}
document.getElementById('testDiv').innerHTML = Balises;
if(navigator.userAgent.indexOf("MSIE")>0) {
isIE=true;
}
TimeFontView=window.setTimeout("Alors()",150);
}function Alors(){
Alpha=Alpha-I_Alpha;
for (x=0;x<Nb;x++){
Alpha1=Alpha+Decal*x;
Cosine=Math.cos(Alpha1);
Ob=document.getElementById("L"+x);
Ob.style.left=(Midx+100*Math.sin(Alpha1)) +"px";
Ob.style.zIndex=20*Cosine + 50;
Ob.style.fontSize=(Taille+5*Cosine +8) +"px"; //Ob.style.fontSize=Taille+25*Cosine;
//Ob.style.color="rgb("+ (Cosine*80 +77) + ","+ (Cosine*80+177) + ",50)";
if(isIE)
Ob.style.color="rgb(255,"+ (Cosine*150 + 105) + ","+(Cosine*60)+")";
else
Ob.style.color = convert(255, (Cosine*150 + 105) ,(Cosine*60));
}
TimeFontView=window.setTimeout("Alors()",150);
}
function getRgb(rgb){
var rgbArr = [];
var newRgb = "";
var r,g,b;
var color = "";
if(rgb.indexOf("rgb")!=-1){
newRgb = rgb.substring(4,rgb.length-1);
rgbArr = newRgb.split(",");
if(rgbArr.length>2){
r = rgbArr[0];
g = rgbArr[1];
b = rgbArr[2];
}
}
return convert(r,g,b);
}
function toHex(N){
N=Math.max(0,N)
N=Math.min(255,N)
return "0123456789ABCDEF".charAt((N-N%16)/16) + "0123456789ABCDEF".charAt(N%16)
}
function convert(R,G,B) {
R=Math.max(0,R)
R=Math.min(255,R)
G=Math.max(0,G)
G=Math.min(255,G)
B=Math.max(0,B)
B=Math.min(255,B)
var color="#"+this.toHex(R)+this.toHex(G)+this.toHex(B);
return color;
}
init();</script>
hch126163
(老胡)
我是说 像钟表那样 的运动轨迹 而不是 那种向里滚动