微信小程序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;
}
相关推荐
张小姐的猫2 天前
【MySQL】访问 & 数据流动原理
android·数据库·mysql·adb·1024程序员节
工业HMI实战笔记3 天前
印刷电路板HMI:SMT贴装的元件定位界面
制造·设计规范·设计语言·1024程序员节
Martina_03213 天前
AI生成3D模型一合并网格,材质就串色?用6步检查材质槽、UV与图集重映射
图像处理·人工智能·3d·材质·uv·游戏策划·1024程序员节
橙光成长3 天前
android-ad-cleaner:android免 Root 批量关闭系统开屏与营销推送
android·1024程序员节
燃烧的枫4 天前
Windows 下 YOLO11 Pose 的 TensorRT C++ 部署
windows·yolo·tensorrt·1024程序员节·yolo11-pose
AI日报派送佬5 天前
2026年11月02日 AI 行业日报|商汤开源 Loop-9B、Pika 发布 H3 Flex 音视频模型、Meta× 傅利叶推出人形机器人 Max
人工智能·微软·开源·音视频·openai·1024程序员节·ai日报
avi91115 天前
【AI教人】UnityEditor扩展Spine动画,Spine骨骼,预览Preview一切
spine·骨骼动画·1024程序员节·editor扩展·spine动画·spine骨骼
开开心心就好5 天前
网页图片批量下载工具,输入链接就保存
服务器·算法·leetcode·支持向量机·pdf·ocr·1024程序员节
Martina_03215 天前
AI生成的3D模型打印后沿层纹开裂?用6步检查方向、壁厚与填充
图像处理·人工智能·数学建模·3d·自然语言处理·游戏策划·1024程序员节