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>
//哇一個問題發了兩遍看我能不能水兩個採納