vue做的一个一点就转的转盘(音乐磁盘),点击停止时会在几秒内缓慢停止,再次点击按钮可以再次旋转,

先看效果:

代码:主要部分我会红线画出来

css:部分:

源码:

vue部分:

<template>

	<div class="song-lyric">

		<div>
			<div class="type">
				<div class="right">
					<div class="right-center" :class="{ 'rotates': isplay }">
						<div>
							<img src="https://imagesone.oss-cn-beijing.aliyuncs.com/imagebishe/player_bar.png"
								class="right-top" :class="{rotated: isplay}">
						</div>
						<div>
							<img src="https://imagesone.oss-cn-beijing.aliyuncs.com/imagebishe/disc.png"
								class="tight-bottm" :style="{ transform: 'rotate(' + rotationAngle + 'deg)' }">
						</div>
					</div>
				</div>
				<div class="lyric-title">
					<!-- 有歌词 -->
					<!-- <el-input v-model="input" placeholder="请输入内"></el-input>
			<el-input v-model="input" placeholder="差不多"></el-input> -->
					<ul class="has-lyric" v-if="lyr.length" key="index">
						<li v-for="(item,index) in lyr" v-bind:key="index">
							{{item[1]}}
						</li>
					</ul>
					<!-- 没有歌词 -->
					<div v-else class="no-lyric" key="no-lyric">
						<span>暂无歌词</span>
					</div>
				</div>
			</div>

		</div>


	</div>


</template>
<script>
	import {
		mixin
	} from '../mixins';
	import {
		mapGetters
	} from 'vuex';

	export default {
		name: 'lyric',
		mixins: [mixin],
		data() {
			return {
				// input: '',
				lyr: [], //当前歌曲的歌词
				isplay: undefined, //获取歌曲开关状态
				rotationAngle: 0 // 记录盒子当前的旋转角度
			}
		},
		computed: {
			
			...mapGetters([
				'curTime', //当前歌曲播放到的位置
				'id', //当前播放的歌曲id
				'lyric', //歌词
				'listIndex', //当前歌曲在歌单中的位置
				'listOfSongs', //当前歌单列表
				'isPlay' //播放状态
			])
		},
		created() {
			this.isplay = this.isPlay//获取开关
			console.log('data', this.isplay);//获取点击图片进去歌词页面的开关状态
			this.lyr = this.lyric;
			this.rotateBox();

			console.log('this.lyr', this.lyr)
			console.log('this.mapGetters', this.mapGetters)
		},
		watch: {
			isPlay() {
				this.isplay = this.isPlay
				console.log('data', this.isplay);
				this.rotateBox();
			},
			id: function() {
				this.lyr = this.parseLyric(this.listOfSongs[this.listIndex].lyric)
			},
			curTime: function() {
				if (this.lyr.length > 0) {
					for (let i = 0; i < this.lyr.length; i++) {
						if (this.curTime >= this.lyr[i][0]) {
							for (let j = 0; j < this.lyr.length; j++) {
								document.querySelectorAll('.has-lyric li')[j].style.color = '#ffffff';
								document.querySelectorAll('.has-lyric li')[j].style.fontSize = '15px';
							}
							if (i >= 0) {
								document.querySelectorAll('.has-lyric li')[i].style.color = '#95d2f6';
								document.querySelectorAll('.has-lyric li')[i].style.fontSize = '25px';
							}
						}
					}
				}
			}
		},
		methods:{
		  
			rotateBox(){
				if(this.isplay){
					this.rotationAngle +=1;
					// if(this.rotationAngle >= 360){
					// 	this.rotationAngle = this.rotationAngle % 360;
					// }
					setTimeout(this.rotateBox, 20);
					// console.log('this.rotateBox',this.rotationAngle)
				}
			}
			   
		}
	}
</script>
<style lang="scss" scoped>
	@import '../assets/css/lyric.scss';
</style>

css部分:

@import "var.scss";


.song-lyric {
  // margin: auto;
  // margin-top: $header-height + 20px;
  width: 100%;
  height: 100%;
  // background-color: $color-white;
  border-radius: 12px;
  display: block;
  background-color: rgb(167, 167, 167);
  // padding: 0 20px 50px 20px;
  // background-color: rgba(0,0,0,.55);
  font-family: $font-family;

  // background-size: cover;
  // filter: blur(30px);
  z-index: 1;

  .lyric-title {
    text-align: center;
	  width: 50%;
    height: 100vh;
		overflow-y: scroll;
    line-height: 60px;
    border-bottom: 2px solid $color-black;
	margin-top: 50px;
	// background: rgba(21, 21, 21, 0.6);
	background-color: rgba(0,0,0,.65);

	z-index: 2;
  }

  .type{
	  display: flex;
	  text-align: center;
	    width: 100%;
	  height: 100vh;
	  	overflow: hidden;
	  line-height: 60px;
	  border-bottom: 2px solid $color-black;
	  z-index: 2;
  }
  .right{
	  text-align: center;
	    width: 50%;
	  height: 100vh;
	  	overflow: hidden;
	  line-height: 60px;
	  border-bottom: 2px solid $color-black;
	  margin-top: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    flex-wrap: wrap;
	  // background: rgba(21, 21, 21, 0.6);
	  background-color: rgba(0,0,0,.65);
	  // backdrop-filter: blur(4px);
	  // box-shadow: inset 0px 1px 6px rgba(255,255,255,0.6), 2px 2px 15px rgba(0,0,0,0.5);
	  z-index: 2;
  }
  
  .right-top{ //指针
    position: absolute; 
	z-index: 1; 
	width: auto; 
	left:45%; 
	top:117px; 
	height:200px;
	
	transition: transform 0.7s linear;  transform: rotate(-30deg) translate(35px , -10px); 
  }
   
  .rotated {
    transform: rotate(0deg);
  }
  
  

  .right-center{
    position: relative;
    width: 600px;
    height: 1000px;
    // background-color: rgb(206, 198, 198);
  }

  .has-lyric {
    font-size: 18px;
    width: 100%;
    min-height: 100%;
    text-align: center;
	padding-top: 120px;
    li {
      width: 100%;
      height: 40px;
      line-height: 40px;
    }
  }

  .no-lyric {
    // margin: 200px 0;
	padding: 200px 0 0 0;
    width: 100%;
    text-align: center;

    span {
      font-size: 18px;
      text-align: center;
    }
  }
}

.lyric-fade-enter,
.lyric-fade-leave-to {
  transform: translateX(30px);
  opacity: 0;
}

.lyric-fade-enter-active,
.lyric-fade-leave-active {
  transition: all 0.3s ease;
}

.tight-bottm{ //圆
    position: absolute;
    top:225px;  
    width: 400px; 
    left:18%; 
    height:400px; 
    border-radius: 50%;
	transition: transform 0.7s linear;
	
  }
  
  .active {
	  animation: none !important;
    // animation: spin 5s linear infinite;
  }
  
  // @keyframes spin {
  //   100% {
  //     transform: rotate(360deg);
  //   }
  // }
  

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/132633.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

SAMBA文件共享与DNS域名服务

一、SAMBA文件共享 1、什么是SAMBA SMB&#xff08;Server Message Block&#xff09;协议实现文件共享&#xff0c;也称为CIFS&#xff08;Common Internet File System &#xff09; 是Windows和类Unix系统之间共享文件的一种协议 客户端主要是Windows&#xff1b;支持多…

mysql 讲解(1)

文章目录 前言一、基本的命令行操作二、操作数据库语句2.1、创建数据库2.2、删除数据库2.3、使用数据库2.4 查看所有数据库 三、列的数据类型3.1 字符串3.2 数值3.3 时间日期3.4 空3.5 int 和 varchar问题总结&#xff1a; 四、字段属性4.1 UnSigned4.2 ZEROFILL4.3 Auto_InCre…

44springboot摄影跟拍预定管理系统

大家好✌&#xff01;我是CZ淡陌。一名专注以理论为基础实战为主的技术博主&#xff0c;将再这里为大家分享优质的实战项目&#xff0c;本人在Java毕业设计领域有多年的经验&#xff0c;陆续会更新更多优质的Java实战项目&#xff0c;希望你能有所收获&#xff0c;少走一些弯路…

Node.js如何处理多个请求?

前言 在计算机科学领域&#xff0c;关于并发和并行的概念经常被提及。然而&#xff0c;这两个术语常常被混为一谈&#xff0c;导致很多人对它们的理解存在着很多混淆。本文小编将通过对并发和并行的深入解析&#xff0c;帮助读者更好地理解它们之间的不同特点和应用场景。同时…

【Unity细节】Unity中如何让组件失活而不是物体失活

&#x1f468;‍&#x1f4bb;个人主页&#xff1a;元宇宙-秩沅 hallo 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! 本文由 秩沅 原创 &#x1f636;‍&#x1f32b;️收录于专栏&#xff1a;unity细节和bug &#x1f636;‍&#x1f32b;️优质专栏 ⭐【…

黑客技术-小白学习手册

一、黑客是什么 原是指热心于计算机技术&#xff0c;水平高超的电脑专家&#xff0c;尤其是程序设计人员。但后来&#xff0c;黑客一词已被用于泛指那些专门利用电脑网络搞破坏或者恶作剧的家伙。 二、学习黑客技术的原因 其实&#xff0c;网络信息空间安全已经成为海陆空之…

Python接口自动化测试Selenium+pytest+数据驱动!

主流自动化框架 selenium &#xff1a;web端自动化框架 &#xff0c;&#xff08;行业里面最核心的框架&#xff09; appium &#xff1a;手机app端框架 requests &#xff1a;接口测试 selenium 工具类封装 selenium提供了很多方法供我们去完成网页元素的操作&#xff0c; …

Postman常见报错与解决方法,持续更新~

postman中文文档 基本操作&#xff1a;从控制台查看请求报错 如果 Postman 无法发送你的请求&#xff0c;或者如果它没有收到你发送请求的 API 的响应&#xff0c;你将收到一条错误消息。此消息将包含问题概述和指向控制台的链接&#xff0c;你可以在其中访问有关请求的详细信…

六度空间(C++)

目录 题目&#xff1a; 输入、输出格式&#xff1a; 代码&#xff1a; 运行结果&#xff1a; 题目&#xff1a; 输入、输出格式&#xff1a; 代码&#xff1a; #include<iostream> #include<algorithm> using namespace std; int g[10005][10005]; float n…

抖音小程序开发实战:打造独特品牌体验的代码之旅

抖音小程序的崛起为品牌提供了一个全新的数字化平台&#xff0c;而通过深入的抖音小程序开发&#xff0c;品牌不仅能够提升曝光度&#xff0c;更能打造独特的用户体验。在本文中&#xff0c;我们将深入研究抖音小程序开发的关键技术要点&#xff0c;并通过实际代码演示&#xf…

拓扑排序软件设计——ToplogicalSort_app(含有源码、需求分析、可行性分析、概要设计、用户使用手册)

拓扑排序软件设计 前言1. 需求分析2. 可行性分析2.1 简介2.2 技术可行性分析2.2.1 技术实现方案2.2.2 开发人员技能要求2.2.3 可行性 2.3 操作可行性分析2.4 结论 3. 项目报告3.1 修订历史记录3.2 软硬件环境3.3 需求分析3.4 详细设计3.4.1 类设计3.4.2 核心流程描述3.4.3 核心…

部署ruoyi-vue-plus和ruoyi-app

nginx.conf worker_processes 1;error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid;events {worker_connections 1024; }http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;# 限制…

黑客技术(网络安全)-自学

前言 一、什么是网络安全 网络安全可以基于攻击和防御视角来分类&#xff0c;我们经常听到的 “红队”、“渗透测试” 等就是研究攻击技术&#xff0c;而“蓝队”、“安全运营”、“安全运维”则研究防御技术。 无论网络、Web、移动、桌面、云等哪个领域&#xff0c;都有攻与防…

SPSS二元Logistic回归

前言&#xff1a; 本专栏参考教材为《SPSS22.0从入门到精通》&#xff0c;由于软件版本原因&#xff0c;部分内容有所改变&#xff0c;为适应软件版本的变化&#xff0c;特此创作此专栏便于大家学习。本专栏使用软件为&#xff1a;SPSS25.0 本专栏所有的数据文件请点击此链接下…

湖南大学-数据库系统-2018期中考试解析

答案是自己做的&#xff0c;仅供参考。 一、单选题&#xff08;每小题2分&#xff0c;共30分&#xff09; 1、下列关于数据库系统正确的描述是&#xff08; A &#xff09;。 A、数据库系统减少了数据的冗余 B、数据库系统避免了一切冗余 C、数据库系统中数据的一致性是指数据…

动态规划(5)---Leetcode338.比特位计数

题目 给你一个整数 n &#xff0c;对于 0 < i < n 中的每个 i &#xff0c;计算其二进制表示中 1 的个数 &#xff0c;返回一个长度为 n 1 的数组 ans 作为答案。 分析 通常动态规划的做题顺序&#xff0c;先确定dp数组dp[i],然后确定确定递推公式&#xff0c;再dp数…

C语言实现写一个函数,求一个字符串的长度,在main函数中输入字符串,并输出其长度

完整代码&#xff1a; // 写一个函数&#xff0c;求一个字符串的长度&#xff0c;在main函数中输入字符串&#xff0c;并输出其长度 #include<stdio.h> //字符串最大长度 #define N 100 int strlen(char *str){int i0;//字符串结尾为‘\0’while (*str!\0){i;//指针移动…

汽车制动系统技术分析概要

目录 1.基本功能概述 2. 基本工作原理分析 2.1 Two-Box系统架构(Bosch_IBooster) 2.2 One-Box系统架构(Bosch_IPB) 2.3 ​​​​​​​ABS技术 2.4 TCS技术 2.5 VDC技术 2.6 EPB技术 2.7 小结 3. 该场景应用发展趋势分析 1.基本功能概述 传统汽车的底盘主要由传动系、…

安全框架SpringSecurity-1(认证入门数据库授权)

一、Spring Security ①&#xff1a;什么是Spring Security Spring Security是一个能够为基于Spring的企业应用系统提供声明式&#xff08;注解&#xff09;的安全访问控制解决方案的安全框架。它提供了一组可以在Spring应用上下文中配置的Bean&#xff0c;充分利用了Spring …

【数据结构】C语言实现单链表万字详解(附完整运行代码)

&#x1f984;个人主页:修修修也 &#x1f38f;所属专栏:数据结构 ⚙️操作环境:Visual Studio 2022 一.了解项目功能 在本次项目中我们的目标是实现一个单链表: 该单链表使用动态内存分配空间,可以用来存储任意数量的同类型数据. 单链表结点(Node)需要包含两个要素:数据域data…
最新文章