B的left = Math.sin((ahd*Bindex))*radius+dotLeft B的top = Math.cos((ahd*Bindex))*radius+dotTop C的left = Math.sin((ahd*Cindex))*radius+dotLeft C的top = Math.cos((ahd*Cindex))*radius+dotTop
function 移动(){
speed ++
left = Math.sin((ahd*Bindex+speed ))*radius+dotLeft;
Math.cos((ahd*Bindex+speed))*radius+dotTop
}
$(function(){
//中心点横坐标
var dotLeft = ($(".container").width()-$(".dot").width())/2;
//中心点纵坐标
var dotTop = ($(".container").height()-$(".dot").height())/2;
//起始角度
var stard = 0;
//半径
var radius = 200;
//每一个BOX对应的角度;
var avd = 360/$(".box").length;
//每一个BOX对应的弧度;
var ahd = avd*Math.PI/180;
//运动的速度
var speed = 2;
//设置圆的中心点的位置
$(".dot").css({"left":dotLeft,"top":dotTop});
//设置DIV圆形排列
$(".box").each(function(index, element){
$(this).css({"left":Math.sin((ahd*index))*radius+dotLeft,"top":Math.cos((ahd*index))*radius+dotTop});
});
//运动函数
var fun_animat = function(){
speed = speed<360?speed:2;
//运运的速度
speed+=2;
//运动距离,即运动的弧度数;
var ainhd = speed*Math.PI/180;
//按速度来定位DIV元素
$(".box").each(function(index, element){
$(this).css({"left":Math.sin((ahd*index+ainhd))*radius+dotLeft,"top":Math.cos((ahd*index+ainhd))*radius+dotTop});
});
}
//定时调用运动函数
var setAnimate = setInterval(fun_animat,100);
})
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有