javascript - 如何用js或者css3實現元素邊框的動態效果,如圖?
問題描述
光圈可以是一個,就這樣類似王者榮耀的頭像框,怎么才能實現?
問題解答
回答1:<!DOCTYPE html><html lang='en'><head> <meta charset='UTF-8'> <title>Document</title> <style>.boxA { position: relative; width: 200px; height: 200px; border:2px solid yellow;}.boxB { position: absolute; width: 10px; height: 10px; top: 0; left: 0; background-color: pink; animation: mymove linear 5s infinite;}@keyframes mymove { 25% {transform: translate(190px,0px); } 50% {transform: translate(190px,190px); } 75% {transform: translate(0px,190px); } 100% {transform: translate(0px,0px); }} </style></head><body> <p class='boxA'><p class='boxB'></p> </p></body></html>回答2:
用 css3動畫屬性,和transform
