Help us understand the problem. What is going on with this article?

javascriptのsplitで1文字ずつ分割してアニメーションさせる

More than 5 years have passed since last update.

“abcde”.split(‘’);の結果
スクリーンショット 2014-01-15 21.17.24.png

こんな感じの何かが出来るのではないかと。
2624d02542e1abea7634ede7034ea468.gif

文字がランダムで降ってくるとか出来そうですね。
※ つくれぽお待ちしております←

split.js

(function(){

    var text = 'Now Loading...';
        arrReceive = [];

    arrReceive = text.split('');

    console.dir(arrReceive);

    var arrLength = arrReceive.length;

    for(var i=0; i<arrLength; i++) {
        arrReceive[i] = '<span class="str-animate">'+ arrReceive[i] +'</span>';
    }


    var htmlText = arrReceive.join("");

    // アニメーション処理
    $('body').append(htmlText);


    var loop = function() {
        $('.str-animate').each(function(_idx) {
            var that = $(this);

            setTimeout(function() {
                that
                    .css({
                        position: "relative"
                    })
                    .animate({
                        top: -30
                    }, 300, function() {
                        that.animate({
                            top: 0
                        }, 300);
                    });
            }, 60*_idx);
        });
    };


    setInterval(loop, 2000);

})();


// ----------------- 参考URL
・ Myth Busting: CSS Animations vs. JavaScript
http://css-tricks.com/myth-busting-css-animations-vs-javascript/
・ CodePen Source
http://codepen.io/GreenSock/pen/AwCKp

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした