当前位置:   article > 正文

vue实现动画旋转_vue 转圈动画

vue 转圈动画

这是jQuery实现地址:https://www.jq22.com/jquery-info17962

 

  1. <template>
  2. <div>
  3. <div id="advert">
  4. <div class="bg1">
  5. <div :class="end ? 'not_bg1_box' : 'bg1_box'">
  6. <img
  7. src="././icons/icon-01.png"
  8. alt=""
  9. :class="['icon01', end ? 'not_img_box' : 'img_box']"
  10. />
  11. <img
  12. src="./icons/icon-02.png"
  13. alt=""
  14. :class="['icon02', end ? 'not_img_box' : 'img_box']"
  15. />
  16. <img
  17. src="./icons/icon-03.png"
  18. alt=""
  19. :class="['icon03', end ? 'not_img_box' : 'img_box']"
  20. />
  21. <img
  22. src="./icons/icon-04.png"
  23. alt=""
  24. :class="['icon04', end ? 'not_img_box' : 'img_box']"
  25. />
  26. <img
  27. src="./icons/icon-05.png"
  28. alt=""
  29. :class="['icon05', end ? 'not_img_box' : 'img_box']"
  30. />
  31. <img
  32. src="./icons/icon-06.png"
  33. alt=""
  34. :class="['icon06', end ? 'not_img_box' : 'img_box']"
  35. />
  36. <img
  37. src="./icons/icon-07.png"
  38. alt=""
  39. :class="['icon07', end ? 'not_img_box' : 'img_box']"
  40. />
  41. </div>
  42. </div>
  43. <div class="bg2">
  44. <div>
  45. <span class="icon08">
  46. <img src="./icons/icon-08.png" alt="" width="10px" />
  47. </span>
  48. <span class="icon09">
  49. <img src="./icons/icon-09.png" alt="" width="30px" />
  50. </span>
  51. <span class="icon10">
  52. <img src="./icons/icon-10.png" alt="" width="20px" />
  53. </span>
  54. </div>
  55. </div>
  56. <van-circle
  57. v-model="currentRate"
  58. :rate="200"
  59. :speed="30"
  60. :text="text"
  61. class="circle"
  62. layer-color="#999999"
  63. :stroke-width="90"
  64. :color="gradientColor"
  65. />
  66. <!-- <div class="bg3">
  67. <div>
  68. <span class="icon11">
  69. <img src="./icons/icon-11.png" alt="" width="26px" />
  70. </span>
  71. <span class="icon12">
  72. <img src="./icons/icon-12.png" alt="" width="18px" />
  73. </span>
  74. </div>
  75. </div> -->
  76. <!-- <div class="content">
  77. <span>立即</span>
  78. <img
  79. src="./icons/finger.png"
  80. alt=""
  81. style="height: 22px; vertical-align: middle"
  82. />
  83. </div> -->
  84. </div>
  85. <!-- <div id="applyfor">
  86. <form>
  87. <div>
  88. <i></i>
  89. <span>信息提交</span>
  90. </div>
  91. <input type="text" placeholder="公司名称" />
  92. <input type="text" placeholder="联系人" />
  93. <input type="tel" placeholder="联系人电话" />
  94. <button type="submit">立即申请</button>
  95. </form>
  96. <div id="shadow"></div>
  97. </div> -->
  98. </div>
  99. </template>
  100. <script>
  101. import Vue from 'vue';
  102. import { Circle } from 'vant';
  103. Vue.use(Circle);
  104. export default {
  105. data: function () {
  106. return {
  107. currentRate: 0,
  108. gradientColor: {
  109. '0%': '#3fecff',
  110. '100%': '#6149f6',
  111. },
  112. rate: 200,
  113. end: false
  114. }
  115. },
  116. computed: {
  117. text () {
  118. let num = this.currentRate.toFixed() * 2;
  119. console.log(this.currentRate)
  120. return num + '/' + 200
  121. // return this.currentRate.toFixed() + '%';
  122. },
  123. },
  124. }
  125. </script>
  126. <style>
  127. html,
  128. body {
  129. padding: 0;
  130. margin: 0;
  131. font-family: "lucida grande", "lucida sans unicode", lucida, helvetica,
  132. "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  133. font-size: 16px;
  134. color: #000000;
  135. }
  136. body {
  137. /* background-image: url(images/bg.jpg); */
  138. background-repeat: no-repeat;
  139. background-size: cover;
  140. background-attachment: fixed;
  141. }
  142. /* 外圈大环的旋转 */
  143. @keyframes animtran {
  144. from {
  145. transform: rotateZ(0deg);
  146. }
  147. to {
  148. transform: rotateZ(360deg);
  149. }
  150. }
  151. /* 内圈环的旋转 */
  152. @keyframes animtrans {
  153. from {
  154. transform: rotateZ(360deg);
  155. }
  156. to {
  157. transform: rotateZ(0deg);
  158. }
  159. }
  160. /* 最内圈环的旋转 */
  161. @-webkit-keyframes animtran {
  162. from {
  163. transform: rotateZ(0deg);
  164. }
  165. to {
  166. transform: rotateZ(360deg);
  167. }
  168. }
  169. @-webkit-keyframes animtrans {
  170. from {
  171. transform: rotateZ(360deg);
  172. }
  173. to {
  174. transform: rotateZ(0deg);
  175. }
  176. }
  177. #advert {
  178. width: 300px;
  179. height: 300px;
  180. margin: 10% auto;
  181. position: relative;
  182. }
  183. #advert .bg1 {
  184. width: 260px;
  185. height: 260px;
  186. position: absolute;
  187. top: 25px;
  188. left: 20px;
  189. z-index: 10;
  190. transform-style: preserve-3d;
  191. transform: perspective(800px) rotateX(-43deg) rotateY(0) rotateZ(100deg);
  192. }
  193. #advert .bg1 .bg1_box {
  194. width: 260px;
  195. height: 260px;
  196. border: #ccc 1px solid;
  197. border-radius: 15em;
  198. position: relative;
  199. animation: animtran 5s linear infinite;
  200. -webkit-animation: animtran 5s linear infinite;
  201. }
  202. #advert .bg1 .not_bg1_box {
  203. width: 260px;
  204. height: 260px;
  205. border: #ccc 1px solid;
  206. border-radius: 15em;
  207. position: relative;
  208. }
  209. #advert .bg1 .img_box {
  210. width: 50px;
  211. position: absolute;
  212. animation: animtrans 5s linear infinite;
  213. -webkit-animation: animtrans 5s linear infinite;
  214. }
  215. #advert .bg1 .not_img_box {
  216. width: 50px;
  217. position: absolute;
  218. }
  219. #advert .bg1 .icon01 {
  220. bottom: 25px;
  221. left: 7px;
  222. }
  223. .icon01:hover {
  224. transform: rotateY(0deg) translateZ(400px);
  225. }
  226. #advert .bg1 .icon02 {
  227. top: 80px;
  228. left: -24px;
  229. }
  230. #advert .bg1 .icon03 {
  231. top: -7px;
  232. left: 44px;
  233. }
  234. #advert .bg1 .icon04 {
  235. top: -7px;
  236. right: 44px;
  237. }
  238. #advert .bg1 .icon05 {
  239. top: 80px;
  240. right: -24px;
  241. }
  242. #advert .bg1 .icon06 {
  243. bottom: 25px;
  244. right: 7px;
  245. }
  246. #advert .bg1 .icon07 {
  247. bottom: -25px;
  248. left: 105px;
  249. }
  250. #advert .bg2 {
  251. width: 180px;
  252. height: 180px;
  253. position: absolute;
  254. top: 66px;
  255. left: 60px;
  256. z-index: 9;
  257. transform-style: preserve-3d;
  258. transform: perspective(800px) rotateX(-43deg) rotateY(0) rotateZ(100deg);
  259. }
  260. #advert .bg2 div {
  261. width: 180px;
  262. height: 180px;
  263. border: #e376bd 1px solid;
  264. border-radius: 15em;
  265. position: relative;
  266. animation: animtrans 12s linear infinite;
  267. -webkit-animation: animtrans 12s linear infinite;
  268. }
  269. #advert .bg2 span {
  270. display: inline-block;
  271. background-color: #ffffff;
  272. overflow: hidden;
  273. border-radius: 15em;
  274. position: absolute;
  275. animation: animtran 6s linear infinite;
  276. -webkit-animation: animtran 6s linear infinite;
  277. }
  278. #advert .bg2 img {
  279. padding: 10px;
  280. display: block;
  281. }
  282. #advert .bg2 .icon08 {
  283. top: 10px;
  284. left: 13px;
  285. }
  286. #advert .bg2 .icon09 {
  287. bottom: 0;
  288. left: 7px;
  289. }
  290. #advert .bg2 .icon10 {
  291. bottom: 40px;
  292. right: -15px;
  293. }
  294. #advert .bg3 {
  295. width: 100px;
  296. height: 100px;
  297. position: absolute;
  298. top: 100px;
  299. left: 100px;
  300. z-index: 8;
  301. }
  302. #advert .bg3 div {
  303. width: 100px;
  304. height: 100px;
  305. border: #e077bf 1px dotted;
  306. border-radius: 15em;
  307. position: relative;
  308. animation: animtran 8s linear infinite;
  309. -webkit-animation: animtran 8s linear infinite;
  310. }
  311. #advert .bg3 span {
  312. display: inline-block;
  313. background-color: #ffffff;
  314. overflow: hidden;
  315. border-radius: 15em;
  316. position: absolute;
  317. animation: animtrans 4s linear infinite;
  318. -webkit-animation: animtrans 4s linear infinite;
  319. }
  320. #advert .bg3 img {
  321. padding: 10px;
  322. display: block;
  323. }
  324. #advert .bg3 .icon11 {
  325. top: -14px;
  326. right: 0px;
  327. }
  328. #advert .bg3 .icon12 {
  329. bottom: -13px;
  330. right: 10px;
  331. }
  332. #advert .content {
  333. width: 130px;
  334. height: 50px;
  335. background: linear-gradient(to right, #fa71ad, #c77dd1);
  336. position: absolute;
  337. z-index: 11;
  338. left: 85px;
  339. top: 125px;
  340. border-radius: 5px;
  341. text-align: center;
  342. line-height: 50px;
  343. color: #fff;
  344. font-size: 20px;
  345. box-shadow: #f6f6f6 8px 8px 8px 4px;
  346. cursor: pointer;
  347. }
  348. @keyframes ani-one {
  349. from {
  350. left: 260px;
  351. }
  352. to {
  353. left: 16px;
  354. }
  355. }
  356. @keyframes ani-two {
  357. from {
  358. left: 260px;
  359. }
  360. to {
  361. left: 70px;
  362. }
  363. }
  364. @keyframes ani-three {
  365. from {
  366. top: 0;
  367. left: 0;
  368. }
  369. to {
  370. top: 8px;
  371. left: 8px;
  372. }
  373. }
  374. @keyframes ani-four {
  375. 0% {
  376. width: 130px;
  377. height: 50px;
  378. left: 85px;
  379. top: 125px;
  380. box-shadow: #f6f6f6 8px 8px 8px 4px;
  381. border: #eee 0px solid;
  382. margin-left: 0;
  383. }
  384. 100% {
  385. width: 259px;
  386. height: 333px;
  387. left: 50%;
  388. top: 0px;
  389. box-shadow: #ffffff 0 0 0 0;
  390. border: #eee 1px solid;
  391. margin-left: -130px;
  392. }
  393. }
  394. @keyframes ani-five {
  395. from {
  396. opacity: 1;
  397. }
  398. to {
  399. opacity: 0;
  400. }
  401. }
  402. @keyframes ani-six {
  403. from {
  404. left: 260px;
  405. }
  406. to {
  407. left: 0;
  408. }
  409. }
  410. @-webkit-keyframes ani-one {
  411. from {
  412. left: 260px;
  413. }
  414. to {
  415. left: 16px;
  416. }
  417. }
  418. @-webkit-keyframes ani-two {
  419. from {
  420. left: 260px;
  421. }
  422. to {
  423. left: 70px;
  424. }
  425. }
  426. @-webkit-keyframes ani-three {
  427. from {
  428. top: 0;
  429. left: 0;
  430. }
  431. to {
  432. top: 8px;
  433. left: 8px;
  434. }
  435. }
  436. @-webkit-keyframes ani-four {
  437. 0% {
  438. width: 130px;
  439. height: 50px;
  440. left: 85px;
  441. top: 125px;
  442. box-shadow: #f6f6f6 8px 8px 8px 4px;
  443. border: #eee 0px solid;
  444. margin-left: 0;
  445. }
  446. 100% {
  447. width: 259px;
  448. height: 333px;
  449. left: 50%;
  450. top: 0px;
  451. box-shadow: #ffffff 0 0 0 0;
  452. border: #eee 1px solid;
  453. margin-left: -130px;
  454. }
  455. }
  456. @-webkit-keyframes ani-five {
  457. from {
  458. opacity: 1;
  459. }
  460. to {
  461. opacity: 0;
  462. }
  463. }
  464. @-webkit-keyframes ani-six {
  465. from {
  466. left: 260px;
  467. }
  468. to {
  469. left: 0;
  470. }
  471. }
  472. #applyfor {
  473. width: 259px;
  474. height: 333px;
  475. margin: 20% auto;
  476. position: relative;
  477. display: none;
  478. }
  479. #applyfor form {
  480. padding: 13px 16px 30px;
  481. width: 225px;
  482. height: 288px;
  483. border: #eee 1px solid;
  484. border-radius: 6px;
  485. /* box-shadow: #f6f6f6 10px 10px 0px; */
  486. position: relative;
  487. background-color: #fff;
  488. overflow: hidden;
  489. }
  490. #applyfor #shadow {
  491. width: 259px;
  492. height: 333px;
  493. border-radius: 5px;
  494. position: absolute;
  495. z-index: -1;
  496. top: 0;
  497. left: 0;
  498. background-color: #f3f3f3;
  499. }
  500. #applyfor button {
  501. width: 120px;
  502. height: 46px;
  503. background: linear-gradient(to right, #fa71ad, #c77dd1);
  504. border-radius: 5px;
  505. text-align: center;
  506. line-height: 46px;
  507. cursor: pointer;
  508. color: #fff;
  509. font-size: 20px;
  510. box-shadow: #f6f6f6 8px 8px 8px 4px;
  511. border: none;
  512. margin: 30px 0;
  513. padding: 0;
  514. position: absolute;
  515. top: 228px;
  516. left: 260px;
  517. }
  518. #applyfor input {
  519. width: 225px;
  520. border: none;
  521. border-bottom: #eee 1px solid;
  522. margin-top: 20px;
  523. padding: 10px 0 10px 26px;
  524. font-size: 16px;
  525. box-sizing: border-box;
  526. background-repeat: no-repeat;
  527. background-size: auto 18px;
  528. background-position: 0 center;
  529. position: absolute;
  530. left: 260px;
  531. }
  532. #applyfor input:nth-child(2) {
  533. background-image: url(./icons/tower.png);
  534. margin-top: 30px;
  535. top: 41px;
  536. }
  537. #applyfor input:nth-child(3) {
  538. background-image: url(./icons/people.png);
  539. top: 110px;
  540. }
  541. #applyfor input:nth-child(4) {
  542. background-image: url(./icons/tel.png);
  543. top: 169px;
  544. }
  545. #applyfor form div {
  546. position: absolute;
  547. width: 257px;
  548. height: 50px;
  549. line-height: 50px;
  550. top: 0;
  551. left: 0;
  552. background-color: #f6f6f6;
  553. }
  554. #applyfor i {
  555. display: inline-block;
  556. width: 6px;
  557. height: 18px;
  558. background: linear-gradient(to bottom, #fa71ad, #c77dd1);
  559. border-radius: 2px;
  560. position: absolute;
  561. top: 16px;
  562. left: 16px;
  563. }
  564. #applyfor span {
  565. margin-left: 34px;
  566. color: #333333;
  567. /* position: absolute;
  568. display: inline-block;
  569. width: 64px; */
  570. }
  571. input::-webkit-input-placeholder {
  572. /* WebKit browsers */
  573. color: #999999;
  574. }
  575. input:-moz-placeholder {
  576. /* Mozilla Firefox 4 to 18 */
  577. color: #999999;
  578. }
  579. input::-moz-placeholder {
  580. /* Mozilla Firefox 19+ */
  581. color: #999999;
  582. }
  583. input:-ms-input-placeholder {
  584. /* Internet Explorer 10+ */
  585. color: #999999;
  586. }
  587. .animation-paused {
  588. animation-play-state: paused !important;
  589. -webkit-animation-play-state: paused !important;
  590. }
  591. .animation-one {
  592. animation: ani-one 0.6s ease 1;
  593. -webkit-animation: ani-one 0.6s ease 1;
  594. }
  595. .animation-two {
  596. animation: ani-two 0.6s ease 1;
  597. -webkit-animation: ani-two 0.6s ease 1;
  598. }
  599. .animation-three {
  600. animation: ani-three 0.6s ease 1;
  601. -webkit-animation: ani-three 0.6s ease 1;
  602. }
  603. .animation-four {
  604. animation: ani-four 0.3s ease 1;
  605. -webkit-animation: ani-four 0.3s ease 1;
  606. }
  607. .animation-five {
  608. animation: ani-five 0.5s ease 1;
  609. -webkit-animation: ani-five 0.5s ease 1;
  610. }
  611. .animation-six {
  612. animation: ani-six 0.6s ease 1;
  613. -webkit-animation: ani-six 0.6s ease 1;
  614. }
  615. .opacity0 {
  616. opacity: 0;
  617. }
  618. .circle {
  619. width: 100px;
  620. height: 100px;
  621. position: absolute;
  622. top: 100px;
  623. left: 100px;
  624. z-index: 8;
  625. }
  626. </style>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/325787
推荐阅读
相关标签