首页 >

JS动画效果代码3【javascript】

web前端|js教程JS动画效果代码3【javascript】
JS,动画效果
web前端-js教程
慢慢来,这次实现了向任意方向扩展!
装扮大赛源码,vscode怎样导出,ubuntu lscpu,tomcat监控pdf,sqlite 好用在哪,ajax无刷新表单提交验证插件代码,前端框架建折线图,拼多多爬虫评论怎么删除,PHP购物车衣架,建筑seo优化团队,帝国网站后台管理系统,uc怎么查看网页源码,dede美丽说模板lzw
  



Untitled Document
android 条形码 源码,vscode的错误提示被关,amd用ubuntu,tomcat四层转发,爬虫框架优点,php上传视频压缩,内蒙古短视频seo优化,特定ip段访问网站代码lzw
<!--
#apDiv1 {
position:absolute;
left:300px;
top:100px;
width:100px;
height:100px;
z-index:1;
background-color: #FF00FF;
}
#apDiv2 {
position:absolute;
left:402px;
top:100px;
width:100px;
height:100px;
z-index:2;
background-color: #00FFFF;
}
#apDiv3 {
position:absolute;
left:402px;
top:200px;
width:100px;
height:100px;
z-index:3;
background-color: #99FF00;
}
#apDiv4 {
position:absolute;
left:300px;
top:200px;
width:100px;
height:100px;
z-index:4;
background-color: #FFFF00;
}
-->

多图 asp 源码,vscode前端vue插件,ubuntu 安装app,tomcat 日志名称,sql数据库改sqlite,爬虫容易办法网络爬崩吗,点击按钮 执行php,谷歌官方seo外推,网站开源程序是什么,网页转换成ppt,微信小程序模板商城lzw




function $(pId){
return document.getElementById(pId);
}

function JPos(){

}

JPos.getAbsPos = function(pTarget){
var _x = 0;
var _y = 0;
while(pTarget.offsetParent){
_x += pTarget.offsetLeft;
_y += pTarget.offsetTop;
pTarget = pTarget.offsetParent;
}
_x += pTarget.offsetLeft;
_y += pTarget.offsetTop;

return {x:_x,y:_y};
}

function JAniObj(){
this.obj = null;
this.interval = null;

this.orgPos = null;
this.targetPos = null;

this.orgSize = {w:50,y:50}; //初始长宽
this.targetSize = {w:100,y:100}; //目标长宽
this.step = {x:10,y:10}; //步长 x:x方向 y:y方向
this.alpha = {s:10,e:90,t:10}; //透明度,s初始,e结束,t步长
}

function JAni(){
var self = this;
var aniObjs = {};

var getCurrentStyleProperty = function(pObj,pProperty){
try{
if(pObj.currentStyle)
return eval(“pObj.currentStyle.” + pProperty);
else
return document.defaultView.getComputedStyle(pObj,””).getPropertyValue(pProperty);
}catch(e){
alert(e);
}
}

this.popup = function(pDiv,pOrgSize,pTargetSize,pStep,pAlpha){

var aniObj = new JAniObj();
aniObjs[pDiv] = aniObj;

with(aniObj){
obj = $(pDiv);
orgPos = JPos.getAbsPos(obj);
orgSize = pOrgSize;
targetSize = pTargetSize;
step = pStep;
alpha = pAlpha;

with(obj.style){
overflow = “hidden”;
position = “absolute”;
width = pOrgSize.w + “px”;
height = pOrgSize.h + “px”;
left = orgPos.x + “px”;
top = orgPos.y + “px”;
if(document.all){
filter = “Alpha(opacity=” + pAlpha.s + “)”;
}else
opacity = pAlpha.s / 100;
}
}

aniObj.interval = setInterval(“popup_(‘” + pDiv + “‘)”,10);
}

popup_ = function(pDivId){

pObj = aniObjs[pDivId];

var w = parseInt(pObj.obj.style.width);
var h = parseInt(pObj.obj.style.height);

if(w >= Math.abs(pObj.targetSize.w) && h >= Math.abs(pObj.targetSize.h)){
clearInterval(pObj.interval);
if(document.all)
pObj.obj.style.filter = “Alpha(opacity=” + pObj.alpha.e + “)”;
else
pObj.obj.style.opacity = pObj.alpha.e / 100;

delete aniObjs[pObj.obj.id];
}else{
if(w < Math.abs(pObj.targetSize.w))
w += pObj.step.x;

if(h < Math.abs(pObj.targetSize.h))
h += pObj.step.y;

if(document.all){
var pattern = /opacity=(\d{1,3})/;
var result = pattern.exec(pObj.obj.style.filter);
if(result != null){
if(result[1] < pObj.alpha.e)
pObj.obj.style.filter = “Alpha(opacity=” + (result[1] + pObj.alpha.t) + “)”
else
pObj.obj.style.filter = “Alpha(opacity=” + pObj.alpha.e + “)”;
}
}else{
if(pObj.obj.style.opacity < pObj.alpha.e / 100){
pObj.obj.style.opacity = parseFloat(pObj.obj.style.opacity) + pObj.alpha.t / 100;
}else
pObj.obj.style.opacity = pObj.alpha.e / 100;
}
}

pObj.obj.style.width = w + “px”;
pObj.obj.style.height = h + “px”;

if(pObj.targetSize.w < 0){
var vLeft = parseInt(getCurrentStyleProperty(pObj.obj,”left”));
vLeft = isNaN(vLeft) ? 0 : vLeft;
pObj.obj.style.left = vLeft – pObj.step.x + “px”;
}

if(pObj.targetSize.h < 0){
var vTop = parseInt(getCurrentStyleProperty(pObj.obj,”top”));
vTop = isNaN(vTop) ? 0 : vTop;
pObj.obj.style.top = vTop – pObj.step.y + “px”;
}
}
}

var ani = new JAni();
ani.popup(
“apDiv1”,
{w:50,h:50}, //初始长宽
{w:200,h:200}, //目标长宽
{x:8,y:8}, //步长
{s:10,e:80,t:10}//透明度 起始,结束,步长
);

ani.popup(
“apDiv2”,
{w:50,h:50}, //初始长宽
{w:-200,h:200}, //目标长宽
{x:8,y:8}, //步长
{s:10,e:40,t:2}//透明度 起始,结束,步长
);

ani.popup(
“apDiv3”,
{w:50,h:50}, //初始长宽
{w:-200,h:-200},//目标长宽
{x:8,y:8}, //步长
{s:10,e:40,t:10}//透明度 起始,结束,步长
);

ani.popup(
“apDiv4”,
{w:50,h:50}, //初始长宽
{w:200,h:-200},//目标长宽
{x:8,y:8}, //步长
{s:10,e:50,t:10}//透明度 起始,结束,步长
);


JS动画效果代码3【javascript】
  • jQuery实现带有动画效果的回到顶部和底部代码【jquery】
  • jQuery实现带有动画效果的回到顶部和底部代码【jquery】 | jQuery实现带有动画效果的回到顶部和底部代码【jquery】 ...

    JS动画效果代码3【javascript】
  • jQuery实现带动画效果的多级下拉菜单代码【jquery】
  • jQuery实现带动画效果的多级下拉菜单代码【jquery】 | jQuery实现带动画效果的多级下拉菜单代码【jquery】 ...

    JS动画效果代码3【javascript】
  • 实现动画效果核心方式的js代码【javascript】
  • 实现动画效果核心方式的js代码【javascript】 | 实现动画效果核心方式的js代码【javascript】 ...