Cara Membuat Tulisan Mengikuti Kursor di Blog

Postingan kali ini adalah script cara membuat tulisan mengikuti arah kursor di blog kita. Tanpa Panjang lebar lansung kita simak cara membuatnya:

1. Login ke blogger sobat.
2. Masuk di Rancangan, dan pilih edit HTML,
3. Back Up terlebih dahulu template sobat dengan cara beri centang (klik) di Expand Template Widget
4. Cari Kode </head>
5. Copy paste kode di bawah ini tepat di atas kode </head> tadi.

<br>
<style type='text/css'><br>#outerCircleText {<br>font-style: italic;<br>font-weight: bold;<br>font-family: 'comic sans ms', verdana, arial;<br>color:<b> <span style="color: rgb(255, 255, 0);">#717D7D</span></b>; /* warna huruf */<br>position: absolute;top: 0;left: 0;z-index: 3000;cursor: default;}<br>#outerCircleText div {position: relative;}<br>#outerCircleText div div {position: absolute;top: 0;left: 0;text-align: center;}<br></style><br><br><script type='text/javascript'><br>//<![CDATA[<br>;(function(){<br>// Your message here (QUOTED STRING)<br>var msg = "<span style="color: rgb(255, 255, 0);">Adhy</span>"; /* tulisan yang muncul */<br>/* THE REST OF THE EDITABLE VALUES BELOW ARE ALL UNQUOTED NUMBERS */<br>// Set font's style size for calculating dimensions<br>// Set to number of desired pixels font size (decimal and negative numbers not allowed)<br>var size =20; /* ukuran huruf */<br>// Set both to 1 for plain circle, set one of them to 2 for oval<br>// Other numbers & decimals can have interesting effects, keep these low (0 to 3)<br>var circleY = 0.75; var circleX = 2;<br>// The larger this divisor, the smaller the spaces between letters<br>// (decimals allowed, not negative numbers)<br>var letter_spacing = 5;<br>// The larger this multiplier, the bigger the circle/oval<br>// (decimals allowed, not negative numbers, some rounding is applied)<br>var diameter = 10;<br>// Rotation speed, set it negative if you want it to spin clockwise (decimals allowed)<br>var rotation = 0.4;<br>// This is not the rotation speed, its the reaction speed, keep low!<br>// Set this to 1 or a decimal less than one (decimals allowed, not negative numbers)<br>var speed = 0.3;<br>////////////////////// Stop Editing //////////////////////<br>if (!window.addEventListener && !window.attachEvent || !document.createElement) return;<br>msg = msg.split('');<br>var n = msg.length - 1, a = Math.round(size * diameter * 0.208333), currStep = 20,<br>ymouse = a * circleY + 20, xmouse = a * circleX + 20, y = [], x = [], Y = [], X = [],<br>o = document.createElement('div'), oi = document.createElement('div'),<br>b = document.compatMode && document.compatMode != "BackCompat"? document.documentElement<br>:<br>document.body,<br>mouse = function(e){<br>e = e || window.event;<br>ymouse = !isNaN(e.pageY)? e.pageY : e.clientY; // y-position<br>xmouse = !isNaN(e.pageX)? e.pageX : e.clientX; // x-position<br>},<br>makecircle = function(){ // rotation/positioning<br>if(init.nopy){<br>o.style.top = (b || document.body).scrollTop + 'px';<br>o.style.left = (b || document.body).scrollLeft + 'px';<br>};<br>currStep -= rotation;<br>for (var d, i = n; i > -1; --i){ // makes the circle<br>d = document.getElementById('iemsg' + i).style;<br>d.top = Math.round(y[i] + a * Math.sin((currStep + i) / letter_spacing) * circleY - 15) +<br>'px';<br>d.left = Math.round(x[i] + a * Math.cos((currStep + i) / letter_spacing) * circleX) + 'px';<br>};<br>},<br>drag = function(){ // makes the resistance<br>y[0] = Y[0] += (ymouse - Y[0]) * speed;<br>x[0] = X[0] += (xmouse - 20 - X[0]) * speed;<br>for (var i = n; i > 0; --i){<br>y[i] = Y[i] += (y[i-1] - Y[i]) * speed;<br>x[i] = X[i] += (x[i-1] - X[i]) * speed;<br>};<br>makecircle();<br>},<br>init = function(){ // appends message divs, & sets initial values for positioning arrays<br>if(!isNaN(window.pageYOffset)){<br>ymouse += window.pageYOffset;<br>xmouse += window.pageXOffset;<br>} else init.nopy = true;<br>for (var d, i = n; i > -1; --i){<br>d = document.createElement('div'); d.id = 'iemsg' + i;<br>d.style.height = d.style.width = a + 'px';<br>d.appendChild(document.createTextNode(msg[i]));<br>oi.appendChild(d); y[i] = x[i] = Y[i] = X[i] = 0;<br>};<br>o.appendChild(oi); document.body.appendChild(o);<br>setInterval(drag, 25);<br>},<br>ascroll = function(){<br>ymouse += window.pageYOffset;<br>xmouse += window.pageXOffset;<br>window.removeEventListener('scroll', ascroll, false);<br>};<br>o.id = 'outerCircleText'; o.style.fontSize = size + 'px';<br>if (window.addEventListener){<br>window.addEventListener('load', init, false);<br>document.addEventListener('mouseover', mouse, false);<br>document.addEventListener('mousemove', mouse, false);<br>if (/Apple/.test(navigator.vendor))<br>window.addEventListener('scroll', ascroll, false);<br>}<br>else if (window.attachEvent){<br>window.attachEvent('onload', init);<br>document.attachEvent('onmousemove', mouse);<br>};<br>})();<br>//]]><br></script>

Catatan :
#717D7D = Ganti dengan Kode warna Tulisan yang sobat inginkan
Adhy = Merupakan kalimat yang mengikuti kursor, ganti dengan kalimat kamu sendiri

Selamat Berkreasi
Comments
0 Comments

0 komentar: