为什么在这个JavaScript动画中,某些元素会去陌生的地方?

为什么在这个JavaScript动画中,某些元素会去陌生的地方?,javascript,jquery,animation,effect,Javascript,Jquery,Animation,Effect,在,我有一个部分损坏的动画;一致性跨浏览器(Mac)测试会引发相同的行为 目的是将代币移动到随机的地方,然后设置它们到达正确位置的动画;您可以在当前主页中看到此功能按每个字符运行 两者基本相似的引擎位于words.html页面中: function journey(index, starting_x, starting_y, target_x, target_y, starting_opacity, target_opacity, delay, radix) { if (isNaN(st

在,我有一个部分损坏的动画;一致性跨浏览器(Mac)测试会引发相同的行为

目的是将代币移动到随机的地方,然后设置它们到达正确位置的动画;您可以在当前主页中看到此功能按每个字符运行

两者基本相似的引擎位于words.html页面中:

function journey(index, starting_x, starting_y, target_x,
target_y, starting_opacity, target_opacity, delay, radix) {
    if (isNaN(starting_x) || isNaN(starting_y) || isNaN(target_x) || isNaN(target_y)) {
        /* console.log('starting_x: ' + starting_x +
                      ' starting_y: ' + starting_y + ' target_x: ' +
                      target_x + ' target_y: ' + target_y); */
        console.log('Returning...');
        return;
    }
    /* console.log(target_x - starting_x + ', ' + (target_y -
                  starting_y)); */
    if (Math.abs(starting_x - target_x) + Math.abs(starting_y - target_y) < 2) {
        // console.log(index);
        jQuery('#text_' + index).css({
            'left': target_x,
            'top': target_y,
            'opacity': target_opacity,
            '-ms-filter':
                'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + target_opacity * 100,
            'filter': 'alpha(opacity=' + target_opacity * 100,
            'position': 'absolute'
        });
    } else {
        if (starting_x - target_x > 0) {
            var new_x = (target_x + Math.floor((starting_x - target_x) * radix));
        } else {
            var new_x = (target_x + Math.ceil((starting_x - target_x) * radix));
        }
        if (starting_y - target_y > 0) {
            var new_y = (target_y + Math.floor((starting_y - target_y) * radix));
        } else {
            var new_y = (target_y + Math.ceil((starting_y - target_y) * radix));
        }
        var new_opacity = target_opacity + (starting_opacity - target_opacity) * radix;
        jQuery('#text_' + index).css({
            'left': new_x,
            'top': new_y,
            'opacity': new_opacity,
            '-ms-filter':
                'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + new_opacity * 100,
            'filter': 'alpha(opacity=' + new_opacity * 100,
            'position': 'absolute'
        });
        setTimeout(function () {
            journey(index, new_x, new_y, target_x, target_y,
            new_opacity, target_opacity, delay, radix);
        }, delay);
    }
}

function start_fade_in() {
    var message = '<p><a href="http://tinyurl.com/classic-orthodox-bible">The Classic Orthodox Bible</a> is a complete Bible that includes Sir Lancelot Brenton\'s translation of the Septuagint (also known as the LXX), the Greek Old Testament as it was known to Christ and many of the earliest Church Fathers. Missing verses and the New Testament are taken from the <a href="http://tinyurl.com/complete-parallel-bible">King James Version</a>, whose style and quality are imitated by Sir Brenton. His translation is available in tiny, hard-to-read letters in the margins of <a href="http://tinyurl.com/brenton-septuagint">Hendrickson\'s Septuagint</a>, more of a shorthand convenience to scholars reading the Greek than genuinely intended for devotional use. Readers wishing for a complete English translation of the Septuagint in a regular Bible, and who appreciate the beauty, grandeur, and meticulous word-for-word accuracy of the <a href="http://tinyurl.com/complete-parallel-bible">King James Version</a> will find the <a href="http://tinyurl.com/classic-orthodox-bible">Classic Orthodox Bible</a> a delight.</p> <p>If you only buy ONE version of the Bible to help you understand Holy Orthodoxy, without a doubt, buy the <a href="http://tinyurl.com/orthodox-study-bible">Orthodox Study Bible</a>...</p> <p>But if you buy two, as there is good reason to do, you might consider the <a href="http://tinyurl.com/classic-orthodox-bible">Classic Orthodox Bible</a>.</p>';
    var message = '<p><a href="http://tinyurl.com/classic-orthodox-bible">The Classic Orthodox Bible</a> a complete Bible like the <a href="http://tinyurl.com/complete-parallel-bible">King James Version</a> that includes the <a href="http://tinyurl.com/brenton-septuagint">Septuagint</a>, and is completely uncensored.</p> <p>Readers wishing for a complete English translation of Orthodox Bible including the Septuagint in a regular Bible, and who appreciate the beauty, grandeur, and meticulous accuracy of the <a href="http://tinyurl.com/complete-parallel-bible">King James</a> will find it a delight.</p> <p>If you only buy ONE version of the Bible to help you understand Holy Orthodoxy, without a doubt, buy the <a href="http://tinyurl.com/orthodox-study-bible">Orthodox Study Bible</a>...</p> <p>But if you buy two, as there is good reason to do, you might consider the <a href="http://tinyurl.com/classic-orthodox-bible">Classic Orthodox Bible</a>.</p>';
    var split_message = message.split(/(<.*?>|)/);
    var split_message = '<p><a href="http://tinyurl.com/classic-orthodox-bible"><span id="text_0">The</span> <span id="text_1">Classic</span> <span id="text_2">Orthodox</span> <span id="text_3">Bible</span></a> <span id="text_4">a</span> <span id="text_5">complete</span> <span id="text_6">Bible</span> <span id="text_7">like</span> <span id="text_8">the</span> <a href="http://tinyurl.com/complete-parallel-bible"><span id="text_9">King</span> <span id="text_10">James</span> <span id="text_11">Version</span></a> <span id="text_12">that</span> <span id="text_13">includes</span> <span id="text_14">the</span> <a href="http://tinyurl.com/brenton-septuagint"><span id="text_15">Septuagint,</span></a> <span id="text_16">and</span> <span id="text_17">is</span> <span id="text_18">completely</span> <span id="text_19">uncensored.</span></p> <p><span id="text_20">Readers</span> <span id="text_21">wishing</span> <span id="text_22">for</span> <span id="text_23">a</span> <span id="text_24">complete</span> <span id="text_25">English</span> <span id="text_26">translation</span> <span id="text_27">of</span> <span id="text_28">Orthodox</span> <span id="text_29">Bible</span> <span id="text_30">including</span> <span id="text_31">the</span> <span id="text_32"><a href="http://tinyurl.com/brenton-septuagint">Septuagint</span></span> <span id="text_33">in</span> <span id="text_34">a</span> <span id="text_35">regular</span> <span id="text_36">Bible,</span> <span id="text_37">and</span> <span id="text_38">who</span> <span id="text_39">appreciate</span> <span id="text_40">the</span> <span id="text_41">beauty,</span> <span id="text_42">grandeur,</span> <span id="text_43">and</span> <span id="text_44">meticulous</span> <span id="text_45">accuracy</span> <span id="text_46">of</span> <span id="text_47">the</span> <a href="http://tinyurl.com/complete-parallel-bible"><span id="text_48">King</span> <span id="text_49">James</span></a> <span id="text_50">will</span> <span id="text_51">find</span> <span id="text_52">it</span> <span id="text_53">a</span> <span id="text_54">delight.</span></p> <p><span id="text_55">If</span> <span id="text_56">you</span> <span id="text_57">only</span> <span id="text_58">buy</span> <span id="text_59">ONE</span> <span id="text_60">version</span> <span id="text_61">of</span> <span id="text_62">the</span> <span id="text_63">Bible</span> <span id="text_64">to</span> <span id="text_65">help</span> <span id="text_66">you</span> <span id="text_67">understand</span> <span id="text_68">Holy</span> <span id="text_69">Orthodoxy,</span> <span id="text_70">without</span> <span id="text_71">a</span> <span id="text_72">doubt,</span> <span id="text_73">buy</span> <span id="text_74">the</span> <a href="http://tinyurl.com/orthodox-study-bible"><span id="text_75">Orthodox</span> <span id="text_76">Study</span> <span id="text_77">Bible</span></a><span id="text_78">...</span></p> <p><span id="text_79">But</span> <span id="text_80">if</span> <span id="text_81">you</span> <span id="text_82">buy</span> <span id="text_83">two,</span> <span id="text_84">as</span> <span id="text_85">there</span> <span id="text_86">is</a> <span id="text_87">good</span> <span id="text_88">reason</span> <span id="text_89">to</span> <span id="text_90">do,</span> <span id="text_91">you</span> <span id="text_92">might</span> <span id="text_93">consider</span> <span id="text_94">the</span> <a href="http://tinyurl.com/classic-orthodox-bible"><span id="text_94">Classic</span> <span id="text_95">Orthodox</span> <span id="text_96">Bible</span></a><span id="text_97">.</span></p>';
    var counter = 0;
    var filtered_message = '<div class="adjusted">';
    var message = '<p><a href="http://tinyurl.com/classic-orthodox-bible"><span id="text_0">The</span> <span id="text_1">Classic</span> <span id="text_2">Orthodox</span> <span id="text_3">Bible</span></a> <span id="text_4">a</span> <span id="text_5">complete</span> <span id="text_6">Bible</span> <span id="text_7">like</span> <span id="text_8">the</span> <a href="http://tinyurl.com/complete-parallel-bible"><span id="text_9">King</span> <span id="text_10">James</span> <span id="text_11">Version</span></a> <span id="text_12">that</span> <span id="text_13">includes</span> <span id="text_14">the</span> <a href="http://tinyurl.com/brenton-septuagint"><span id="text_15">Septuagint,</span></a> <span id="text_16">and</span> <span id="text_17">is</span> <span id="text_18">completely</span> <span id="text_19">uncensored.</span></p> <p><span id="text_20">Readers</span> <span id="text_21">wishing</span> <span id="text_22">for</span> <span id="text_23">a</span> <span id="text_24">complete</span> <span id="text_25">English</span> <span id="text_26">translation</span> <span id="text_27">of</span> <span id="text_28">Orthodox</span> <span id="text_29">Bible</span> <span id="text_30">including</span> <span id="text_31">the</span> <span id="text_32"><a href="http://tinyurl.com/brenton-septuagint">Septuagint</span></span> <span id="text_33">in</span> <span id="text_34">a</span> <span id="text_35">regular</span> <span id="text_36">Bible,</span> <span id="text_37">and</span> <span id="text_38">who</span> <span id="text_39">appreciate</span> <span id="text_40">the</span> <span id="text_41">beauty,</span> <span id="text_42">grandeur,</span> <span id="text_43">and</span> <span id="text_44">meticulous</span> <span id="text_45">accuracy</span> <span id="text_46">of</span> <span id="text_47">the</span> <a href="http://tinyurl.com/complete-parallel-bible"><span id="text_48">King</span> <span id="text_49">James</span></a> <span id="text_50">will</span> <span id="text_51">find</span> <span id="text_52">it</span> <span id="text_53">a</span> <span id="text_54">delight.</span></p> <p><span id="text_55">If</span> <span id="text_56">you</span> <span id="text_57">only</span> <span id="text_58">buy</span> <span id="text_59">ONE</span> <span id="text_60">version</span> <span id="text_61">of</span> <span id="text_62">the</span> <span id="text_63">Bible</span> <span id="text_64">to</span> <span id="text_65">help</span> <span id="text_66">you</span> <span id="text_67">understand</span> <span id="text_68">Holy</span> <span id="text_69">Orthodoxy,</span> <span id="text_70">without</span> <span id="text_71">a</span> <span id="text_72">doubt,</span> <span id="text_73">buy</span> <span id="text_74">the</span> <a href="http://tinyurl.com/orthodox-study-bible"><span id="text_75">Orthodox</span> <span id="text_76">Study</span> <span id="text_77">Bible</span></a><span id="text_78">...</span></p> <p><span id="text_79">But</span> <span id="text_80">if</span> <span id="text_81">you</span> <span id="text_82">buy</span> <span id="text_83">two,</span> <span id="text_84">as</span> <span id="text_85">there</span> <span id="text_86">is</a> <span id="text_87">good</span> <span id="text_88">reason</span> <span id="text_89">to</span> <span id="text_90">do,</span> <span id="text_91">you</span> <span id="text_92">might</span> <span id="text_93">consider</span> <span id="text_94">the</span> <a href="http://tinyurl.com/classic-orthodox-bible"><span id="text_94">Classic</span> <span id="text_95">Orthodox</span> <span id="text_96">Bible</span></a><span id="text_97">.</span></p>';
    jQuery('.display').html(message);
    var initial_coordinates = [];
    for (var index = 0; index < 100; ++index) {
        if (jQuery('#text_' + index).size()) {
            var coordinates = jQuery('#text_' + index).offset();
            initial_coordinates.push({
                'index': index,
                    'left': coordinates['left'],
                    'top': coordinates['top']
            });
        }
    }
    for (var index = 0; index < initial_coordinates.length; ++index) {
        if (jQuery('#text_' + initial_coordinates[index]['index']).size()) {
            var radius = Math.random() * (jQuery(window).width() + jQuery(window).height());
            var angle = Math.random() * 2 * 3.1415926535;
            var starting_x = (
            initial_coordinates[index]['left'] + Math.cos(angle) * radius);
            // console.log('starting_y: ' + starting_x);
            var starting_y = (
            initial_coordinates[index]['top'] + Math.sin(angle) * radius);
            // console.log('starting_x: ' + starting_y);
            journey(initial_coordinates[index]['index'],
            starting_x, starting_y,
            initial_coordinates[index]['left'],
            initial_coordinates[index]['top'], Math.random(),
            1, 1, .9);
        }
    }
}

start_fade_in();
功能行程(索引、起始时间、起始时间、目标时间、,
目标不透明度,起始不透明度,目标不透明度,延迟,基数){
if(isNaN(起点x)| isNaN(起点y)| isNaN(目标x)| isNaN(目标y)){
/*console.log('starting_x:'+starting_x+
'起始y:'+起始y+'目标x:'+
target_x+“target_y:”+target_y)*/
log('Returning…');
返回;
}
/*log(target_x-starting_x+','+(target_y-
开始);*/
if(Math.abs(starting_x-target_x)+Math.abs(starting_y-target_y)<2){
//控制台日志(索引);
jQuery('#text'+index).css({
“左”:目标x,
“顶部”:目标是,
“不透明度”:目标不透明度,
“-ms过滤器”:
'progid:DXImageTransform.Microsoft.Alpha(不透明度='+目标不透明度*100,
“过滤器”:“alpha(不透明度=”+目标透明度*100,
“位置”:“绝对”
});
}否则{
如果(开始\u x-目标\u x>0){
var new_x=(target_x+Math.floor((start_x-target_x)*基数));
}否则{
var new_x=(target_x+Math.ceil((start_x-target_x)*基数));
}
如果(开始时间-目标时间>0){
var new_y=(target_y+数学地板((start_y-target_y)*基数));
}否则{
var new_y=(target_y+Math.ceil((start_y-target_y)*基数));
}
var new_opacity=目标_opacity+(起始_opacity-目标_opacity)*基数;
jQuery('#text'+index).css({
“左”:新的,
"顶":新",
“不透明度”:新的不透明度,
“-ms过滤器”:
'progid:DXImageTransform.Microsoft.Alpha(不透明度='+新的不透明度*100,
“过滤器”:“alpha(不透明度=”+新的不透明度*100,
“位置”:“绝对”
});
setTimeout(函数(){
旅程(索引、新x、新y、目标x、目标y、,
新不透明度、目标不透明度、延迟、基数);
},延误);
}
}
函数启动\淡入(){
var message='是一本完整的圣经,其中包括兰斯洛特·布伦顿爵士对《七首歌》(也称为《LXX》)的翻译,基督和许多最早的教父都知道的希腊《旧约》。缺失的诗句和《新约》摘自《圣经》,其风格和质量由布伦顿爵士模仿。他的译本以极小的、难以阅读的字母在页边空白处提供,对于阅读希腊语的学者来说,这更像是一种速记便利真正用于虔诚的用途。希望在普通圣经中有完整的七旬节英文译本的读者,以及欣赏圣经的美丽、宏伟和一字不差的精确性的读者,会感到很高兴。

如果你只购买一个版本的圣经来帮助你理解神圣的正统教义,毫无疑问,请购买…

< P>但是如果你买两个,因为有很好的理由去做,你可以考虑。 var message='像《圣经》这样的完整的圣经,包括《圣经》,并且完全未经审查。

希望获得正统圣经(包括普通圣经中的《七重奏》)的完整英文译本,并且欣赏《圣经》的美丽、宏伟和精确性的读者会觉得很高兴。

如果你只购买一个版本圣经中有助于你理解神圣正统,毫无疑问,买…

< p>但是如果你买两个,因为有充分的理由去做,你可以考虑.< /p>; var split_message=message.split(/(|)); var split_message='一本完整的圣经,如,包括,并且完全未经审查。

读者希望获得正统圣经的完整英文译本,包括,会觉得很高兴。

如果你只购买一个版本的圣经来帮助你理解神圣正统,毫无疑问,请购买…

,但是如果你买两个,因为有很好的理由去做,你可以考虑。 var计数器=0; var过滤的_消息=“”; var message='一本完整的圣经,如包含并完全未经审查。

读者希望获得正统圣经(包括)的完整英文译本,会感到很高兴。

如果你只购买一个版本的圣经来帮助你理解神圣正统,毫无疑问,购买…

但如果你购买了WO,因为有很好的理由去做,你可以考虑。 jQuery('.display').html(消息); var初始坐标=[]; 对于(var指数=0;指数<100;++指数){ if(jQuery('#text#'+index).size()){ var坐标=jQuery('#text"+index).offset(); 初始推力({ “索引”:索引, “左”:坐标[“左”], “顶部”:坐标[“顶部”] }); } } 对于(var索引=0;索引<初始坐标.length;++索引){ if(jQuery('#text'+初始坐标[index]['index']).size()){ var radius=Math.random()*(jQuery(window.width()+jQuery(window.height()); var angle=Math.random()*2*3.1415926535; var启动_x=( 初始坐标[索引][‘左’]+数学坐标(角度)*半径); //console.log('starting_y:'+starting_x); var起始值_y=( 初始坐标[索引]['top']+Math.sin(ang
<span id="text_86">is</a>