js+css实现黑白旋转切换图片效果代码

代码语言:html

所属分类:其他

代码描述:js+css实现黑白旋转切换图片效果代码

代码标签: js css 黑白 旋转 切换 图片

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

  
  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Caveat:wght@400..700&display=swap");

body {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100vh;
	background: #000;
	color: white;
	gap: 40px;
	font-family: "Bebas Neue", serif;
	font-size: 2.5em;
	overflow: hidden;
}

.container {
	position: relative;
	background: white;
	background-image: url(//repo.bfw.wiki/bfwrepo/images/trans/1WgmFviu12pxFdyMIsswhQ2LFKithDEWX=w2000.jpg);
	background-size: contain;
	background-position: center center;
	background-repeat: no-repeat;
	width: 100%;
	max-width: 1200px;
	height: 50%;
	border-radius: 40px;
	margin: 0px 24px;
}

.filter {
	position: absolute;
	filter: invert(1);
	transition: left 0.5s ease-in-out, transform 0.5s ease-in-out;
	top: -200%;
	left: -150%;
	width: 200%;
	height: 500%;
	background: #000;
	mix-blend-mode: difference;
	pointer-events: none;
	transform-origin: 100% 50%;
}

#mask {
	width: 100%;
	height: 100%;
	object-fit: contain;
	width: 100%;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
}

h1 {
	text-align: center;
	color: black;
	justify-content: center;
	fi.........完整代码请登录后点击上方下载按钮下载查看

网友评论0