Following the mouse rotation text _ Mouse effect

Source: Internet
Author: User
Tags cos sin

<script language= "JavaScript" > if (document.all) {Yourlogo = "Welcome to the cloud-dwelling community"; Logofont = "Song Body"; Logocolor = "000000"; Yourlogo = Yourlogo.split ("); L = Yourlogo.length; Trigsplit = 360/l; Sz = new Array () logowidth = 100; Logoheight =-30; ypos = 0; xpos = 0; Step = 0.03; Currstep = 0; document.write (' <div id= ' outer "><div >"); for (i = 0; i < L; i++) {document.write (' <div id= "ie" + ' width:10px;height:10px;font-family: ' +logofont+ '; font-s ize:12px; ' + ' color: ' +logocolor+ '; Text-align:center ' > ' +yourlogo[i]+ ' </div> '); } document.write (' </div></div> '); function Mouse () {ypos = Event.y; Xpos = event.x-5; } Document.onmousemove=mouse; function Animatelogo () {outer.style.pixelTop = Document.body.scrollTop; for (i = 0; i < L; i++) {ie[i].style.top = ypos + logoheight * Math.sin (currstep + i * trigsplit * math.pi/180); Ie[i].style.left = xpos + logowidth * Math.Cos (currstep + i *Trigsplit * math.pi/180); Sz[i] = Ie[i].style.pixeltop-ypos; if (Sz[i] < 5) Sz[i] = 5; Ie[i].style.fontsize = sz[i]/1.7; } currstep-= step; SetTimeout (' Animatelogo () ', 20); } window.onload = Animatelogo; } </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

This is a text that follows the rotation of the mouse, I hope that when the font is rotated, the colors of each word are different. Do not know how to achieve it?
<script language= "JavaScript" > if (document.all) {Yourlogo = "seven-degree space welcome"; Logofont = "Song Body"; Logocolor = ["F0f8ff", "FAEBD7", "00FFFF", "7fffd4", "F0ffff", "F5F5DC", "Ffe4c4", "000000", "FFEBCD", "0000FF", "8a2be2", "A52A2A", "DEB887", "5f9ea0", "7fff00", "d2691e", "Ff7f50", "6495ED", "FFF8DC", "dc143c", "00FFFF", "00008B", "008b8b", " b8860b "," a9a9a9 "," 006400 "," bdb76b "," 8b008b "," 556b2f "," ff8c00 "," 9932CC "," 8b0000 "," e9967a "," 8fbc8b "," 483d8b "," 2F4F4F "," 00ced1 "," 9400d3 "," FF1493 "," 00BFFF "," 696969 "," 1e90ff "," B22222 "," FFFAF0 "," 228b22 "," ff00ff "," DCDCDC "," F8f8ff "," FFD700 "," DAA520 "," 808080 "," 008000 "," adff2f "," f0fff0 "," ff69b4 "," cd5c5c "," 4b0082 "," FFFFF0 "," f0e68c "," E6e6fa "," Fff0f5 "," 7cfc00 "," FFFACD "," Add8e6 "," F08080 "," E0ffff "," FAFAD2 "," 90ee90 "," D3d3d3 "," Ffb6c1 "," ffa07a "," 20B2AA "," 87CEFA "," 778899 "," B0C4DE "," FFFFE0 "," 00ff00 "," 32cd32 "," Faf0e6 "," ff00ff "," 800000 "," 66CDAA "," 0000CD "," Ba55d3 "," 9370DB "," 3cb371 "," 7b68ee "," 00fa9a "," 48d1cc "," C71585 "," 191970 "," F5fffa "," Ffe4e1 "," ffe4b5 "," Ffdead "," 000080 "," Fdf5e6 "," 808000 "," 6b8e23 "," FFA500 "," FF4500 "," Da70d6 "," Eee8aa "," 98fb98 "," afeeee "," DB7093 "," FFEFD5 "," FFDAB9 "," cd853f "," FFC0CB " , "DDA0DD", "B0e0e6", "800080", "FF0000", "bc8f8f", "4169E1", "8b4513", "FA8072", "f4a460", "2e8b57", "Fff5ee", "a0522d", " C0c0c0 "," 87CEEB "," 6A5ACD "," 708090 "," Fffafa "," 00ff7f "," 4682b4 "," d2b48c "," 008080 "," D8bfd8 "," FF6347 "," 40e0d0 "," Ee82ee "," f5deb3 "," F5f5f5 "," FFFF00 "," 9acd32 "]; Yourlogo = Yourlogo.split ("); L = Yourlogo.length; Trigsplit = 360/l; Sz = new Array () logowidth = 100; Logoheight =-30; ypos = 0; xpos = 0; Step = 0.03; Currstep = 0; document.write (' <div id= ' outer "><div >"); for (i = 0; i < L; i++) {document.write (' <div id= "ie" + ' width:10px;height:10px;font-family: ' +logofont+ '; font-s ize:12px; ' + ' color: ' +logocolor[math.floor (Math.random () *logocolor.length)]+ ' text-align:center ' > ' +yourlogo[i]+ ' </ Div> '); } document.write (' </div></div> '); function Mouse () {ypos = Event.y; Xpos = event.x-5; } docuMent.onmousemove=mouse; function Animatelogo () {outer.style.pixelTop = Document.body.scrollTop; for (i = 0; i < L; i++) {ie[i].style.top = ypos + logoheight * Math.sin (currstep + i * trigsplit * math.pi/180); Ie[i].style.left = xpos + logowidth * Math.Cos (currstep + i * trigsplit * math.pi/180); Sz[i] = Ie[i].style.pixeltop-ypos; if (Sz[i] < 5) Sz[i] = 5; Ie[i].style.fontsize = sz[i]/1.7; } currstep-= step; SetTimeout (' Animatelogo () ', 20); } window.onload = Animatelogo; } </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.