image.png

一、网易云

  1. <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
  2. <style>
  3. * {
  4. margin: 0;
  5. padding: 0
  6. }
  7. .handle {
  8. position: absolute;
  9. left:37%;
  10. transform-origin: 60px 60px;
  11. transform: rotate(-30deg);
  12. }
  13. .container{
  14. position: relative;
  15. width:600px;
  16. }
  17. .pan{
  18. position: absolute;
  19. top:200px;
  20. }
  21. .move{
  22. animation: move 2s forwards;
  23. }
  24. @keyframes move{
  25. 0%{
  26. transform:rotate(-30deg)
  27. }
  28. 100%{
  29. transform:rotate(0deg)
  30. }
  31. }
  32. @keyframes unmove{
  33. 0%{
  34. transform:rotate(0deg)
  35. }
  36. 100%{
  37. transform:rotate(-30deg)
  38. }
  39. }
  40. .unmove{
  41. animation: unmove 2s forwards;
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <div class="container">
  47. <img @click="handleClick" class="pan" src="images/pan.png" alt="">
  48. <img :class="[isPlay?'move':'unmove','handle']" src="images/shou.png" alt="">
  49. </div>
  50. <script>
  51. new Vue({
  52. el:".container",
  53. data:{
  54. isPlay:false
  55. },
  56. methods:{
  57. handleClick(){
  58. this.isPlay = !this.isPlay;
  59. }
  60. }
  61. })
  62. </script>