JSFiddle - React, Tailwind, and code Playground
by danielfilho
HTML
<link href='http://fonts.googleapis.com/css?family=Ropa+Sans' rel='stylesheet' type='text/css'>
<h1 id="text0">This is a ShuffleText.js Examle</h1>
<div style="width:465px">
<ul style="float:left; width:230px;">
<li id="text1">2012/02/04 TOP PAGE UPDATE.</li>
<li id="text2">2012/02/03 ABOUT PAGE UPDATE.</li>
<li id="text3">2012/02/02 CONTACT PAGE UPDATE.</li>
<li id="text4">2012/01/30 NEWS PAGE UPDATE.</li>
<li id="text5">2012/01/25 INDEX PAGE UPDATE.</li>
<li id="text6">2012/01/20 NEWS PAGE UPDATE.</li>
<li id="text7">2012/01/16 ABOUT PAGE UPDATE.</li>
<li id="text8">2012/01/12 LAUNCHED.</li>
</ul>
<ul style="float:right; width:230px;">
<li id="text9">2012/02/04 TOP PAGE UPDATE.</li>
<li id="text10">2012/02/03 ABOUT PAGE UPDATE.</li>
<li id="text11">2012/02/02 CONTACT PAGE UPDATE.</li>
<li id="text12">2012/01/30 NEWS PAGE UPDATE.</li>
<li id="text13">2012/01/25 INDEX PAGE UPDATE.</li>
<li id="text14">2012/01/20 NEWS PAGE UPDATE.</li>
<li id="text15">2012/01/16 ABOUT PAGE UPDATE.</li>
<li id="text16">2012/01/12 LAUNCHED.</li>
</ul>
<br style="clear:both;">
</div>
<p id="text17">ShuffleText.js is under MIT Lisence.</p>
<p id="copyright">© copyright 2012, <a href="http://clockmaker.jp/">clockmaker.jp</a></p>
CSS
body {font-family: 'Ropa Sans', cursive;}
h1 {
font-size: 16px;
cursor: pointer;
color: #900;
}
p, li {
font-size: 12px;
cursor: pointer;
color: #333;
}
li:hover { color: #900; }
ul{
list-style-position: inside;
padding: 0;
line-height: 2;
}
JavaScript
/*
* ShuffleText by Yasunobu Ikeda. Feb 3, 2012
* Visit http://clockmaker.jp/ for documentation, updates and examples.
*
*
* Copyright (c) 2012 Yasunobu Ikeda
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
(function (window) {
/**
* DOMエレメント用ランダムテã‚ストクラス
* @param DOMエレメント
*/
function ShuffleText(element) {
this._element = element;
this.setText(element.innerHTML);
}
var p = ShuffleText.prototype;
/** ランダムテã‚ストã«ç”¨ã„ã‚‹æ–‡å—列 */
p.sourceRandomCharacter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
/** 空白ã«ç”¨ã„ã‚‹æ–‡å—列 */
p.emptyCharacter = "-";
/** フレームレート */
p.fps = 60;
/** å†ç”Ÿä¸ã‹ã©ã†ã‹ã‚’示ã™ãƒ–ール値 */
p.isRunning = false;
/** エフェクトã®å®Ÿè¡Œæ™‚é–“ */
p.duration = 600;
p._orijinalStr = "";
p._orijinalLength = "";
p._intervalId =...