久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

css3 - css做動畫效果

瀏覽:165日期:2023-06-26 17:53:36

問題描述

css3 - css做動畫效果

把紅色框內做成那種來回動畫效果怎么做啊?

問題解答

回答1:

<!DOCTYPE html><html><head><style> p{ width:100px; height:100px; background:red; position:relative; animation:mymove 1s infinite; -moz-animation:mymove 1s infinite; /* Firefox */ -webkit-animation:mymove 1s infinite; /* Safari and Chrome */ -o-animation:mymove 1s infinite; /* Opera */ animation-direction: alternate;}@keyframes mymove{ from {left:0px;} to {left:200px;}}@-moz-keyframes mymove /* Firefox */{ from {left:0px;} to {left:200px;}}@-webkit-keyframes mymove /* Safari and Chrome */{ from {left:0px;} to {left:200px;}}@-o-keyframes mymove /* Opera */{ from {left:0px;} to {left:200px;}}</style></head><body><p></p></body></html>

運行一下上面的代碼,改于w3school。

鏈接為:http://www.w3school.com.cn/cs...

回答2:

給你個鏈接 自己對著改參數

回答3:

給那個三角圖片 擺好位置后, 用類去控制動作。

比如

.move { -webkit-animation-name:’example’; // other code} @-webkit-keyframes ’example’ { 0% {-webkit-transform: translateX(0); } 50% { -webkit-transform: translateX(100px); } 100% { -webkit-transform: translateX(0); } } // 補充說明: -webkit-animation-name:’xxx’;/*動畫屬性名,也就是我們前面keyframes定義的動畫名*/ -webkit-animation-duration: 10s;/*動畫持續時間*/ -webkit-animation-timing-function: ease-in-out; /*動畫頻率,和transition-timing-function是一樣的*/ -webkit-animation-delay: 2s;/*動畫延遲時間*/ -webkit-animation-iteration-count: 10;/*定義循環資料,infinite為無限次*/ -webkit-animation-direction: alternate;/*定義動畫方式* 回答4:

css3的動畫效果主要是通過過渡來實現的,用animate來定義一個補間動畫,瀏覽器會自動根據設置的時間來進行渲染。樓上兩位大神的代碼已經做得很完善了,具體效果題主可以自己根據需要修改

標簽: CSS
相關文章:
主站蜘蛛池模板: 海晏县| 宝兴县| 定陶县| 普陀区| 德兴市| 开封县| 西乡县| 广汉市| 昌平区| 阿荣旗| 基隆市| 高陵县| 拜城县| 鲁甸县| 年辖:市辖区| 海丰县| 宿迁市| 汉阴县| 丰都县| 兴山县| 临夏县| 灵宝市| 前郭尔| 呼玛县| 墨玉县| 高尔夫| 广水市| 葫芦岛市| 临夏市| 和硕县| 临泽县| 疏勒县| 扶沟县| 图们市| 高碑店市| 武穴市| 大埔县| 沙田区| 阳原县| 房山区| 汨罗市|