滑动带特效代码(图标滑动特效)
admin 发布:2022-12-19 23:40 143
今天给各位分享滑动带特效代码的知识,其中也会对图标滑动特效进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
如何使用flash as2.0代码实现滑动屏幕切换效果?
list_mc 是要移动的对象(MC),之前写滑动效果没有实现鼠标跟随,这次加上了鼠标跟随,还有缓冲的效果,同时需要判断鼠标滑动的角度和滑动的距离,AS 代码如下:
root = this;
root.k = 3;
// 移动的宽度
root.blockWidth = 300;
root.enabledMove = false;
root.enRun = false;
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
if (root.enRun == true) { // 这次动作没完成,不能进行第二次
return;
}
root.enRun = true;
root.startX = _xmouse;
root.startY = _ymouse;
// 目标的 _x 初始位置
root.mcStartX = root.list_mc._x;
root.onEnterFrame = function() {
root.endX = _xmouse;
root.endY = _ymouse;
xx = Math.abs(root.endX-root.startX);
yy = Math.abs(root.endX-root.startY);
cc = Math.sqrt((xx*xx)+(yy*yy));
if (cc == 0) {
corner = 0;
} else {
corner = (yy/cc)*90;
}
//trace('xx:'+xx);
if (corner50 xx120) {
root.enabledMove = true;
moveBa();
}
};
};
mouseListener.onMouseUp = function() {
if (root.enabledMove == true) { // 鼠标点击,需要移动后才能执行
root.enabledMove == false;
root.endX = _xmouse;
delete root.onEnterFrame;
root.onEnterFrame = function() {
moveBa();
};
}
};
Mouse.addListener(mouseListener);
function moveBa() {
//mcEndX = root.mcStartX+(root.endX-root.startX);
if ((root.endX-root.startX)0) {
offset = root.blockWidth;
} else {
offset = -root.blockWidth;
}
mcEndX = root.mcStartX+offset;
//trace(mcEndX+":"+root.list_mc._x);
root.list_mc._x += (mcEndX-root.list_mc._x)/root.k;
if (Math.abs((mcEndX-root.list_mc._x))1) {
root.list_mc._x = mcEndX;
trace(root.list_mc._x);
root.enRun = false;
delete root.onEnterFrame;
}
}
网页css设置鼠标移动有特效
首先我们创建一个html文件,写出html文件的一些基础代码
然后我们在网页中新建一个div,并新建一个
无序列表并创建4个然后使用浏览器直接打开html文件,查看效果,可以看到我们创建的标签自带有一定的格式,
接下来我们使用下面的代码去除标签的格式,其中:list-style:none; 表示去除标签的格式width:160px; 表示设置标签的宽height:240px;表示设置标签的高background:#666666;表示设置标签的背景色float:left;表示设置标签浮动显示,并且为左浮动margin-right:20px;表示设置标签右外边距
刷新浏览器中html文件查看效果,
这里我们开始添加动画:
给
标签添加:
transition:transform 0.1s;
transform表示变换的属性,0.1上表示表换所需要的时间另外给标签添加鼠标滑动属性
li:hover{cursor:pointer;transform:translate(0,-10px);}
cursor:pointer;表示鼠标滑过显示为小手形状
transform:translate(0,-10px);translate表示移动,第一个参数为水平移动值,第二个参数为垂直移动值,
进入浏览器直接查看效果,如下图实现了鼠标滑过块,块上移的动画特效,如下图:
html5上下滑动“翻页”实现,是真正的翻页
HTML5手机上下滑动翻页特效是一款手机移动端触屏滑动效果实现完整代码如下:
1、html5页面代码
!DOCTYPE html
htmlheadmeta http-equiv="Content-Type" content="text/html; charset=UTF-8"
titleHTML5手机页面触屏滑动上下翻页特效/title
meta charset="utf-8"
meta name="apple-touch-fullscreen" content="YES"
meta name="format-detection" content="telephone=no"
meta name="apple-mobile-web-app-capable" content="yes"
meta name="apple-mobile-web-app-status-bar-style" content="black"
meta http-equiv="Expires" content="-1"
meta http-equiv="pragram" content="no-cache"
link rel="stylesheet" type="text/css" href="./hamer_files/main.css"
link rel="stylesheet" type="text/css" href="./hamer_files/endpic.css"
script type="text/javascript" src="./hamer_files/offline.js"/script
meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi"
/head
body class="s-bg-ddd pc no-3d perspective yes-3d" style="-webkit-user-select: none;"
section class="u-alert"
img style="display:none;" src="./hamer_files/loading_large.gif"
div class="alert-loading z-move"
div class="cycleWrap" span class="cycle cycle-1"/span
span class="cycle cycle-2"/spanspan class="cycle cycle-3"/spanspan class="cycle cycle-4"/span
/div
div class="lineWrap" span class="line line-1"/spanspan class="line line-2"/spanspan class="line line-3"/span
/div
/div
/section
section class="u-arrow"
p class="css_sprite01"/p
/section
section class="p-ct transformNode-2d transformNode-3d" style="height: 918px;"
div class="translate-back" style="height: 918px;"
div class="m-page m-fengye" data-page-type="info_pic3" data-statics="info_pic3" style="height: 918px;"
div class="page-con lazy-finish" data-position="50% 50%" data-size="cover" style="height: 920px; background-image: url(hamer_files/1.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px;"
div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/2.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px;"
div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/3.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px;"
div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/4.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px;"
div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/5.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px;"
div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/6.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px;"
div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/7.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px;"
div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/8.jpg); background-size: cover; background-position: 50% 50%;"/div
/div
/div
/section
section class="u-pageLoading"
img src="./hamer_files/load.gif" alt="loading"
/section
script src="./hamer_files/init.mix.js" type="text/javascript" charset="utf-8"/script
script src="./hamer_files/coffee.js" type="text/javascript" charset="utf-8"/script
script src="./hamer_files/99_main.js" type="text/javascript" charset="utf-8"/script
/body/html
2、css代码:
@charset "utf-8";
.ad_foot li { margin:0 auto 1em; font-size:1.8em; padding:15px; background:#FFF;}
.ad_foot li a {display:block;}
.ad_foot li .l {width:75px; height:75px; float:left; overflow:hidden;}
.ad_foot li .l img {width:75px; width:75px;}
.ad_foot li .r {width:78%; float:left; margin-left:30px; color:#666; overflow:hidden;}
.ad_foot li .r p {color:#999; font-size:1.2em; }
.ad_foot li .r span {font-size:0.8em;}
.ad_foot li .r i {font-style:normal;}
.lazy-img, .lazy-finish{background-color:#f0eded;}
.page-list{font-size:20px;font-family: "Microsoft yahei";padding-left:17px;padding-top:30px;height:35px;border-bottom:1px solid #b5b5b5;display:none;}
.ad_foot{padding:15px 15px 0 15px;}
/*声音播放按钮*/
#song_img {width:293px; height:41px; display:block; position:absolute; right:4.1em; top:1.6em; font-size:1.7em; text-align:center; line-height:41px; color:#FFF; background:url(../img/music_c3.png) no-repeat 0 0;}
/*底部推荐*/
.ad_list{margin-top:2em;}.ad_list li {width:46%; background:none; padding:0; float:left;margin-bottom: 1em;}
.ad_list li.r {float:right;}.ad_list li a img {width:100%; height:auto;}
.ad_foot h3 {width:100%; height:48px; line-height:48px; background:#F9F5EC;}
.ad_foot h3 a {display:inline-block; color:#444; width:50%; text-align:center; font-size:1.5em; height:48px; border-bottom:2px solid #FF9240;}
.ad_foot h3 a.active {color:#FFF; background:#FF9240;}
.magazine_1 li {
width:100%;
margin-bottom: 1em;
font-size: 1.8em;
padding: 15px;
background: #FFF;}
.magazine_1 li a {display:block;}
.magazine_1 li .l {width: 75px;
height: 75px;
float: left;
overflow: hidden;}
.magazine_1 li .l img {width:75px; height:75px;}
.magazine_1 li .r {width: 78%;
float: left;
margin-left: 30px;
color: #666;
overflow: hidden;}
.magazine_1 li .r p {
color: #999;
font-size: 1.2em;
.magazine_1 li .r span {font-size:0.8em;}
.ad_foot li .r i {font-style:normal;}
3、运行效果如下:
谁有FLASH制作的左右滑屏效果代码啊
//请在场景中绘制影片剪辑(注意注册点选在中心),并取实例名:my_mc,然后复制如下帧代码
//我是在flash8下测试的。
//导入Tween类
import mx.transitions.Tween;
//导入easing类
import mx.transitions.easing.*;
//以下函数接受三个参数:受控的目标影片剪辑、受控属性、效果持续时间
function show(_mc:MovieClip, _string:String, _num:Number):Void {
var my_Twen1 = new Tween(_mc, _string, Elastic.easeInOut, 10, 100, _num, true);
}
function hide(_mc:MovieClip, _string:String, _num:Number):Void {
var my_Twen1 = new Tween(_mc, _string, Elastic.easeOut, 100, 10, _num, true);
}
//ku即“酷”之意,调用以上两个自定义函数,实现模仿触屏效果。
function kushow(_mc:MovieClip, _num:Number):Void {
show(_mc, "_xscale", _num);
show(_mc, "_yscale", _num);
show(_mc, "_alpha", _num);
}
function kuhide(_mc:MovieClip, _num:Number):Void {
hide(_mc, "_xscale", _num);
hide(_mc, "_yscale", _num);
hide(_mc, "_alpha", _num);
}
var 状态 = "大";
_root.my_mc.onRelease = function() {
if (状态 == "大") {
状态 = "小";
kuhide(_root.my_mc, 2);
} else {
状态 = "大";
kushow(_root.my_mc, 2);
}
};
滑动带特效代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于图标滑动特效、滑动带特效代码的信息别忘了在本站进行查找喔。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-06css特效代码大全1(css字体特效代码)[20240506更新]
- 05-06表白css特效代码(html520表白代码)[20240506更新]
- 05-06js页面左右滑动特效代码(js滚动特效)[20240506更新]
- 05-05bootstrap图片特效代码(bootstrap图标怎么用)[20240505更新]
- 05-05tab滑动门代码(css滑动门代码)[20240505更新]
- 05-05网页动画话图片特效代码(网页文字动画)[20240505更新]
- 05-04菜单滑动代码(开始菜单自动滚动)[20240504更新]
- 05-042015qq秀特效代码(特效代码)[20240504更新]
- 05-03动态网站背景特效代码(网页动态背景源代码)[20240503更新]
- 05-03花瓣网页特效代码(花瓣特效素材)[20240503更新]
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接