$(document).ready(function(){ intromove(); function intromove() { tweenlite.from($("#intro .el1"), 1, {css:{top: 50, left: 10}, delay:2.1}); tweenlite.from($("#intro .el2"), 1, {css:{top: 100, left: 20}, delay:2.2}); tweenlite.from($("#intro .el3"), 1, {css:{top: 150, left: 30}, delay:2.3}); tweenlite.from($("#intro .el4"), 1, {css:{top: 260, left: 40}, delay:2.4}); tweenlite.from($("#intro .el5"), 1, {css:{top: 330, left: 50}, delay:2.5}); tweenlite.from($("#intro .el6"), 1, {css:{top: 50, left: 450}, delay:2.6}); tweenlite.from($("#intro .el7"), 1, {css:{top: 100, left: 450}, delay:2.7}); tweenlite.from($("#intro .el8"), 1, {css:{top: 260, left: 450}, delay:2.8}); tweenlite.from($("#intro .el9"), 1, {css:{top: 330, left: 450}, delay:2.9}); tweenlite.from($("#intro .electro"), 1, {css:{top: 280}, oncomplete:intromoveend}); $("#intro .electro").show(); } function intromoveend(){ elerandommove("start"); } var interval_ele; function elerandommove(type){ if(type == "start"){ clearinterval(interval_ele); interval_ele = setinterval(function () { tweenlite.to($("#intro .el1"), 1, {css:{top: math.floor(math.random() * 0 +(86)), left: math.floor(math.random() * 0 +(200))}}); tweenlite.to($("#intro .el2"), 1, {css:{top: math.floor(math.random() * 0 +(115)), left: math.floor(math.random() * 0 +(120))}}); tweenlite.to($("#intro .el3"), 1, {css:{top: math.floor(math.random() * 0 +(175)), left: math.floor(math.random() * 0 +(115))}}); tweenlite.to($("#intro .el4"), 1, {css:{top: math.floor(math.random() * 0 +(200)), left: math.floor(math.random() * 0 +(80))}}); tweenlite.to($("#intro .el5"), 1, {css:{top: math.floor(math.random() * 0 +(280)), left: math.floor(math.random() * 0 +(100))}}); tweenlite.to($("#intro .el6"), 1, {css:{top: math.floor(math.random() * 0 +(90)), left: math.floor(math.random() * 0 +(400))}}); tweenlite.to($("#intro .el7"), 1, {css:{top: math.floor(math.random() * 0 +(160)), left: math.floor(math.random() * 0 +(440))}}); tweenlite.to($("#intro .el8"), 1, {css:{top: math.floor(math.random() * 0 +(190)), left: math.floor(math.random() * 0 +(490))}}); tweenlite.to($("#intro .el9"), 1, {css:{top: math.floor(math.random() * 0 +(230)), left: math.floor(math.random() * 0 +(430))}}); }, 2000); }else{ clearinterval(interval_ele); } } })