微信小程序25__实现卡片变换

先看效果图

实现代码如下:

html 复制代码
<view class="page" style="filter:hue-rotate({{rotation}}deg)">
	<view class="prev" catchtap="toPrev">《《《</view>
	<view class="next" catchtap="toNext">》》》</view>
	<view class="stage" style="transform:rotateZ({{rotation}}deg)">
		<view wx:for="{{list}}" wx:key="index" class="page-item">
			<image src="../image/doll.png" style="filter:hue-rotate({{-rotation}}deg)" />
			<view class="title">测试</view>
			<view style="margin-top:30px">{{item.title}}</view>
		</view>
	</view>
</view>
javascript 复制代码
Page({
  data: {
     rotation: 0,
        list: [{color: "pink",
            title: "welcom to susu1",
          },
          { color: "pink",
            title: "welcom to bbq2",
          },
          { color: "pink",
            title: "welcom to xx3",
          },
          {color: "pink",
            title: "welcom to yyy4",
          }]
  }, toPrev(){
        let rotation1 = this.data.rotation;
        rotation1 += 90;
        this.setData({
          rotation:rotation1 
        })
  },toNext() {
        let rotation_ = this.data.rotation;
        rotation_ -= 90;
        this.setData({
          rotation: rotation_
        })
  }
})
css 复制代码
.page {
  position: relative;
  z-index: 11;
  width:100%;
  height: 100vh;
  overflow: hidden;
  background-image: linear-gradient(135deg, #ec8845 0%, #c495f3 100%);
  transition: -webkit-filter 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
  transition: filter 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
  transition: filter 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955), -webkit-filter 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
  
.next {
  z-index: 11;
  color: #000000;
  height: 4vh;
  margin-top: -2vh;
  opacity: 1;
  position: absolute;
  top:50%;
  -webkit-transform: scaleX(0.8);
  transform: scaleX(0.8);
  transition: opacity 200ms linear;
  width: 4vh;
  -webkit-transform: rotate(0deg);
  border: solid #fff;
  border-width: 0 3px 3px 0;
  display: inline-block;
  padding: -1px;
  right: 30px;
}
  
.prev {
  z-index: 11;
  color:#000;
  height: 4vh;
  margin-top: -2vh;
  opacity: 0.7;
  position: absolute;
  top:50%;
  -webkit-transform: scaleX(1);
  transform: scaleX(1);
  transition: opacity 200ms linear;
  width: 4vh;
  -webkit-transform: rotate(0deg);
  border: solid #fff;
  border-width: 0 3px 3px 0;
  display: inline-block;
  padding: -1px;
  left: 30px;
}
  
.stage {
  width: 750rpx;
  height: 100vh;
  left: 0;
  position: absolute;
  top: 0;
  -webkit-transform-origin:50% 150%;
  transform-origin:50% 150%;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  transition: -webkit-transform 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
  transition: transform 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
  transition: transform 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955), -webkit-transform 500ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
  
.page-item {
  top: 0;
  left: 0;
  height:100%;
  padding: 0 5vh;
  position: absolute;
  text-align: center;
  -webkit-transform-origin:50% 150%;
  transform-origin:50% 150%;
  width:100%;
  color: #fff;
  box-sizing: border-box;
}
  
.page-item:nth-child(2) {
  -webkit-transform: rotateZ(90deg);
  transform: rotateZ(90deg);
}
  
.page-item:nth-child(3) {
  -webkit-transform: rotateZ(180deg);
  transform: rotateZ(180deg);
}
  
.page-item:nth-child(4) {
  -webkit-transform: rotateZ(270deg);
  transform: rotateZ(270deg);
}
  
.title {
  font-size: 30px;
  text-align: center;
}

.page-item image {
  border-radius:50%;
  width: 150px;
  height: 150px;
  margin-top: 200px;
}
相关推荐
开开心心就好1 天前
版本转换工具,支持Win双系统零售批量版
linux·运维·服务器·pdf·散列表·零售·1024程序员节
开开心心就好2 天前
免费卸载工具,可清理残留批量管理启动项
linux·运维·服务器·windows·随机森林·pdf·1024程序员节
unable code2 天前
攻防世界-Misc-4-1
网络安全·ctf·misc·1024程序员节
yBmZlQzJ4 天前
免费内网穿透-端口转发配置介绍
运维·经验分享·docker·容器·1024程序员节
金融小师妹5 天前
AI算法视角下非农夜冲击波来袭,黄金高位区间震荡态势的深度神经网络解析
大数据·深度学习·1024程序员节
全栈小57 天前
【数据库】浙人医携手金仓数据库,打造全国首个多院区异构多活容灾架构
数据库·1024程序员节·金仓
CoderYanger9 天前
贪心算法:7.最长连续递增序列
java·算法·leetcode·贪心算法·1024程序员节
CoderYanger9 天前
贪心算法:6.递增的三元子序列
java·算法·leetcode·贪心算法·1024程序员节
CoderYanger9 天前
贪心算法:1.柠檬水找零
java·算法·leetcode·贪心算法·1024程序员节
CoderYanger9 天前
贪心算法:4.摆动序列
java·算法·leetcode·贪心算法·1024程序员节