css实现毛玻璃效果

10 篇文章 0 订阅

毛玻璃效果

效果图

在这里插入图片描述


基本属性:

  • 毛玻璃使用backdrop-filter属性调整背景滤镜效果
  • linear-gradient设置线性渐变
  • radial-gradient设置径向渐变

template

<template>
	<view class="cardWrap">
		<view class="sun"></view>
		<view class="card">
			<view class="h1">Lucky Card</view>
			<view class="h2">6228 8888 9999 5209</view>
			<view class="h3">A Lucky Bank.</view>
			<view class="h4">05 / 20</view>
		</view>
		<view class="circle"></view>
		<view class="rect"></view>
	</view>
</template>

css

<style lang="scss" scoped>
	.cardWrap {
		height: 100vh;
		background: radial-gradient(
		  circle at 20px 20px,
		  rgba(248, 255, 174, 0.8),
		  transparent 25%
		),
		radial-gradient(
		  circle at 60% 90%,
		  rgba(253, 200, 48, 1),
		  transparent 60%
		),
		#2980B9;
	}
	
	.h1 {
		padding: 100rpx 0 150rpx;
	}
	
	.sun {
		width: 100rpx;
		height: 100rpx;
		position: absolute;
		top: 60rpx;
		left: 35%;
		border-radius: 50%;
		box-shadow: -12px 0px 0 rgba(220, 238, 220, 0.7);
		transform: translateX(-50%) rotate(210deg);
	}
	
	.card {
		position: absolute;
		right: 70rpx;
		bottom: 225rpx;
		z-index: 10;
		width: 350rpx;
		height: 650rpx;
		text-align: center;
		border-radius: 20rpx;
		border: 1rpx solid rgba(255, 255, 255, 0.4);
		border-width: 0 0 1rpx 1rpx;
		backdrop-filter: blur(10rpx);
		box-shadow: 20rpx -20rpx 40rpx rgba(0, 0, 0, 0.2), -20rpx 20rpx 40rpx rgba(255, 255, 255, 0.1);
		background: linear-gradient(to top right, rgba(198, 255, 221, 0.6), rgba(251, 215, 134, 0.8), rgba(247,121,125, 1));
		transform: rotate(-12deg);
		transform-origin: bottom;
		view {
			color: rgba(255, 255, 255, 0.8);
		}
	}
	
	.circle {
		width: 300rpx;
		height: 300rpx;
		position: absolute;
		left: 45%;
		transform: translateX(-50%);
		bottom: 100rpx;
		border-radius: 50%;
		background: linear-gradient(to top left, rgb(18, 194, 233), rgb(196, 113, 237), rgb(247, 121, 125));
	}
	
	.rect {
		width: 300rpx;
		height: 300rpx;
		position: absolute;
		right: 40rpx;
		bottom: 710rpx;
		border-radius: 20rpx;
		background: linear-gradient(to bottom left, rgba(18, 194, 233, 0.9), rgba(196, 113, 237, 0.9), rgba(75, 162, 237, 0.9));
	}
</style>
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值