@@ -5,6 +5,10 @@ All animations were inspired and implemented by CodePen.
5
5
- [ Table of contents] ( #table-of-contents )
6
6
- [ 3D Card] ( #3d-card )
7
7
- [ CSS] ( #css )
8
+ - [ 3D Carousel] ( #3d-carousel )
9
+ - [ Start Effect] ( #start-effect )
10
+ - [ Image 3D Effect] ( #image-3d-effect )
11
+ - [ Mouse Event Effect] ( #mouse-event-effect )
8
12
9
13
## Table of contents[ ] ( #table-of-contents )
10
14
- 3D Card
@@ -21,4 +25,73 @@ This project is a project that implements a 3D card using CSS.
21
25
-webkit-box-shadow: 2px 35px 32px -8px rgba(0, 0, 0, 0.75);
22
26
-moz-box-shadow: 2px 35px 32px -8px rgba(0, 0, 0, 0.75);
23
27
}
28
+ ```
29
+
30
+ ## 3D Carousel[ ] ( #3d-carousel )
31
+ <img align =" center " src =" /screenshot/3D_Carousel/Carousel.jpg " alt =" 3D_Carousel " style =" width :100% ;height :100% " />
32
+ This project is a project that implements the image carousel effect using CSS and JavaScript.
33
+
34
+ ### Start Effect
35
+ ```
36
+ for (var i = 0; i < imgs.length; i++) {
37
+ imgs[i].style.transform = "rotateY(" + i * (360 / imgs.length) + "deg) translateZ(" + radius + "px)";
38
+ imgs[i].style.transition = "transform 1s";
39
+ imgs[i].style.transitionDelay = delayTime || (imgs.length - i) / 4 + "s";
40
+ }
41
+ ```
42
+
43
+ ### Image 3D Effect
44
+ ```
45
+ img {
46
+ transform-style: preserve-3d;
47
+ position: absolute;
48
+ left: 0;
49
+ top: 0;
50
+ width: 100%;
51
+ height: 100%;
52
+ line-height: 200px;
53
+ font-size: 50px;
54
+ text-align: center;
55
+ box-shadow: 0 0 8px #fff;
56
+ -webkit-box-reflect: below 10px linear-gradient(transparent, transparent, #0005);
57
+ }
58
+ ```
59
+
60
+ ### Mouse Event Effect
61
+ ```
62
+ document.onpointerdown = function (e) {
63
+ clearInterval(wheel.timer);
64
+ e = e || window.event;
65
+ var sX = e.clientX, sY = e.clientY;
66
+
67
+ this.onpointermove = function (e) {
68
+ e = e || window.event;
69
+ var nX = e.clientX, nY = e.clientY;
70
+ desX = nX - sX;
71
+ desY = nY - sY;
72
+ tX += desX * 0.1;
73
+ tY += desY * 0.1;
74
+ applyTransform(wheel);
75
+ sX = nX;
76
+ sY = nY;
77
+ };
78
+
79
+ this.onpointerup = function (e) {
80
+ wheel.timer = setInterval(function () {
81
+ desX *= 0.95;
82
+ desY *= 0.95;
83
+ tX += desX * 0.1;
84
+ tY += desY * 0.1;
85
+ applyTransform(wheel);
86
+ playSpin(false);
87
+ if (Math.abs(desX) < 0.5 && Math.abs(desY) < 0.5) {
88
+ clearInterval(wheel.timer);
89
+ playSpin(true);
90
+ }
91
+ }, 17);
92
+ this.onpointermove = this.onpointerup = null;
93
+ };
94
+
95
+ return false;
96
+ };
24
97
```
0 commit comments