A. 怎样用js把CSS动画封装起来
1.进入网站有一个视频,希望视频播放完之后触发动画,但是视频受网络影响,实际播放完成的时间不好控制。
2.所以css的延迟时间不好控制,如果视频卡了一下,时间就错过了
3.怎样能在视频完成的时候触发animation呢?
4.下面是动画,div从左到右运动
#banner-cloud-1{
position: absolute;
top: 0px;
left: 0;
-webkit-animation:cloud-move-1 5s linear;
-o-animation:cloud-move-1 5s linear;
animation:cloud-move-1 5s linear;
-webkit-animation-delay: 6s;
-o-animation-delay: 6s;
animation-delay: 6s;
-webkit-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
}
@keyframes cloud-move-1{
from{
left: 0;
}
to{
left:-3760px;
}
}
5.下面是视频结束时触发的函数
videos.onended = function(){
//触发事件一
//触发事件二
//触发事件三
//........
//触发上面的 animation 动画
}
B. 如何用js控制css中的帧动画
/持续设置来图片旋自转角度,使其显示旋转动画
setInterval(function(){
$("#donghua").css({"position":"relative","left":-n+"px","background-position":n+"px 0px"});
n=(n>-777)?n-111:-111;
},300);
</script>
C. css3 实现动画效果,怎样使他无限循环动下去
主要需要使用 -webkit-animation
如:
-webkit-animation:gogogo 2s infinite linear ;
其中gogogo是自己定义的动画帧,2s是整个动画的秒数,infinite是永久循环 linear是线性变化 (step-end则是无线性变化,直接输出结果)
代码如下:
CSS:
@-webkit-keyframes gogogo {
0%{
-webkit-transform: rotate(0deg);
border:5px solid red;
}
50%{
-webkit-transform: rotate(180deg);
background:black;
border:5px solid yellow;
}
100%{
-webkit-transform: rotate(360deg);
background:white;
border:5px solid red;
}
}
.loading{
border:5px solid black;
border-radius:40px;
width: 28px;
height: 188px;
-webkit-animation:gogogo 2s infinite linear ;
margin:100px;
}
D. js+css如何实现动画效果
简单的不用js就行
<!DOCTYPEHTML>
<html>
<head>
<metacharset="utf8">
<title>untitled</title>
<linkrel="stylesheet"type="text/css"href="">
<styletype="text/css">
*{
margin:0px;
padding:0px;
}
#a{
position:absolute;
width:50px;
height:50px;
background-color:#f3e9e0;
border-radius:50%;
left:400px;
top:200px;
}
#adiv{
position:absolute;
width:50px;
height:50px;
border-radius:50%;
transition:all0.5s;
left:0px;
top:0px;
}
#a:nth-child(1){
background-color:#c1d4ed;
}
#a:nth-child(2){
background-color:#7d6e69;
}
#a:nth-child(3){
background-color:#dad6d5;
}
#a:nth-child(4){
background-color:#caaa9d;
}
#a:nth-child(5){
background-color:#6bdeff;
}
#a:hover:nth-child(1){
left:150px;
top:-150px;
}
#a:hover:nth-child(2){
left:150px;
top:150px;
}
#a:hover:nth-child(3){
left:300px;
top:-150px;
}
#a:hover:nth-child(4){
left:300px;
top:150px;
}
#a:hover:nth-child(5){
left:450px;
top:0px;
}
</style>
</head>
<body>
<divid='a'>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
鼠标伸到球上 自动扩散移动
E. 如何用css、js把一张图片上的图案制作成动画
把你的图片按1、2、3。。。的顺序命名 以便用循环调用 具体js可用setInterval函数
F. 如何用htHTML+CSS+JS实现如下图效果,即图片循环滚动播放
<!DOCTYPEhtml>
<html>
<metacharset="utf-8"/>
<title></title>
t>
<scripttype="text/javascript"src="js/slider.js"></script>
<scripttype="text/javascript"src="js/jquery-1.9.1.min.js"></script>
<body>
<divid="banner_tabs"class="flexslider">
<ulclass="slides">
<li>
<a>
<imgwidth="1920"height="600"style="background:url(images/banner_1.jpg)no-repeatcenter;"src="images/alpha.png">
</a>
</li>
<li>
<a>
<imgwidth="1920"height="600"style="background:url(images/banner_2.jpg)no-repeatcenter;"src="images/alpha.png">
</a>
</li>
<li>
<a>
<imgwidth="1920"height="600"style="background:url(images/banner_3.jpg)no-repeatcenter;"src="images/alpha.png">
</a>
</li>
</ul>
<ulclass="flex-direction-nav">
<li><aclass="flex-prev"href="javascript:;">Previous</a></li>
<li><aclass="flex-next"href="javascript:;">Next</a></li>
</ul>
<olid="bannerCtrl"class="flex-control-navflex-control-paging">
<liclass="active"><a>1</a></li>
<liclass=""><a>2</a></li>
<liclass=""><a>3</a></li>
</ol>
</div>
<scriptsrc="js/jquery.js"></script>
<scripttype="text/javascript">
$(function(){
varbannerSlider=newSlider($('#banner_tabs'),{
time:5000,
delay:400,
event:'hover',
auto:true,
mode:'fade',
controller:$('#bannerCtrl'),
activeControllerCls:'active'
});
$('#banner_tabs.flex-prev').click(function(){
bannerSlider.prev()
});
$('#banner_tabs.flex-next').click(function(){
bannerSlider.next()
});
})
</script>
</body>
</html>
==========================================
slider,jq自己下载,相信不用我教。
顺便可以看看教程,对这些有点了解。
G. 如何用js创建css3的动画
可以的
在js操作只是添加或者删除class样式,css中才是关键
H. JS 怎么动态设置CSS3动画的样式
引入jquery
然后给你要设置动画的对象增加或者删除css3动画的类就可以了。
如我这里用colorchange这个渐变类在css里面写好动画效果以后在js里面给对象添加上就可以实现动画了
<!DOCTYPEhtml>
<html>
<headlang="en">
<metacharset="UTF-8">
<title>Test</title>
<styletype="text/css">
body{
padding:20px;
background-color:#FFF;
}
.colorchange
{
animation:myfirst5s;
-moz-animation:myfirst5s;/*Firefox*/
-webkit-animation:myfirst5s;/*SafariandChrome*/
-o-animation:myfirst5s;/*Opera*/
}
@keyframesmyfirst
{
from{background:red;}
to{background:yellow;}
}
@-moz-keyframesmyfirst/*Firefox*/
{
from{background:red;}
to{background:yellow;}
}
@-webkit-keyframesmyfirst/*SafariandChrome*/
{
from{background:red;}
to{background:yellow;}
}
@-o-keyframesmyfirst/*Opera*/
{
from{background:red;}
to{background:yellow;}
}
#main{
width:100px;
height:100px;
background:red;
}
#cgbt{
width:100px;
margin:20px000;
text-align:center;
cursor:pointer;
}
#cgbt:hover{
background-color:#2D93CA;
}
</style>
</head>
<body>
<divid="main">
我会变么?
</div>
<divid="cgbt">
点我让上面的变颜色
</div>
<scriptsrc="jquery-3.2.1.min.js"type="application/javascript"></script>
<script>
$(document).ready(function(){
$("#cgbt").click(function(){
$("#main").attr("class","colorchange");
});
});
</script>
</body>
</html>
I. 请问用js或者css3怎么能实现元素边框动画效果,如图!
无需js css3直接能搞定材料:3张png (背景框框,两个发光的点点);布局用定位做css3里面的回animation做动画hover触发动画请问答用js或者css3怎么能实现元素边框动画效果,如图!
J. 怎样用js或者css来实现这种效果
<html>
<head>
<style>
</style>
<body>
<canvasid="emmm"width="233"height="233"></canvas>
</body>
<script>
varcanvas=document.getElementById('emmm');
varctx=canvas.getContext('2d');
img=newImage();
img.src="http://s6.sinaimg.cn/mw690/006xDASvzy73Xzra5sV55&690";
img.onload=function(){
ctx.drawImage(img,0,0);
ctx.globalCompositeOperation="destination-atop";
//canvas重叠属性
//http://www.w3school.com.cn/tags/canvas_globalcompositeoperation.asp
ctx.font="bold50px微软雅黑";
ctx.fillStyle="rgba(0,0,0,0);";
ctx.fillText("哈哈",50,100);
}
</script>
</head>
</html>
//哇一个问题发了两遍看我能不能水两个采纳