? ??? ?? ???? ? 3D ?? ??? ???? ???? ?? ?? ?? ??? ? ?? ??? ??????. ?? ??? ?? CSS ?? ?? ?? 1? ?? ????? ?????? CSS, SASS ? ????? JavaScript? ?? ??? ???? ?? ?? ??? ?? ?? ??? ?????.
? ???
-
?? ?? ?? ?? ?? ??? ????
- ??? ???? ?? ??? ??? ?????.
- ?? ?? ??? ???? ??
-
? ???? ?? ? ?? ?????? ???? ????? ?? ??? 3 ? ??? ???? ??? ????????? ???? ?? ? ? ??? ?? ????? ??? ?? ? ? ????. ???, ? ?? ???? ????? ?? ?? ??? ???, ????? ?? ???? ?? ? ????. ?????? ??, ??? ??? ??? ???? ??? ??? 3 ?? ???? ??? ?????. ??? ?? ?? ??? ??? ????. -
<<> ?? ?? ? ??>
??? ??? ??? ?? ??? ?? ???? ? ?? ???? ? ??? ??? ????? ?? ???? ????????. - <(> ??? ? (n)? ? ??> ??? ?? ??? ?? ?? ??????. ???? (?) ??? ??? html5 ?? (??)?? ??????. ?? ??? ??? (BFC)? html5? ? api? ???? ????. ??? ??? ?? ?? ??? ???? ???? ??? ???? ? ?????.
- <<> CSS ?? ??
?? ???, ?? ?? ?? ????? ?? ?? z = 0? ???, ?? ???? ??? ??? ????? ??? ?? 2D ??? ????. ??? ?? D? CSS ?? ??? ?? ?????.
? ?????? ? ????? ?? CSS ??? ?? ??????. ???? ???????.
?? ?? ? ???? ?? SASS ??? ???? ?? ????? ?? ???? ? ? ???????. <p>? ???? ?? ??? ??? ?? ???? ???? ??? ???? ?? <strong>? ?????. </strong>
</p> <p> ??? ? ?? ???? ?? ???? ?? ???? ???? ???? ?? ????????. ?? ?? ??? ?? ? ???? ??? ??? ???? ??? ??? ??? ? ????.
</p>
<p> ??? ?? ? ??? ?? ??? ??? ???? ?? ??? ???? (??? ?? ? ??? ???? ???????). ??? ????, ?? ? ???? ??? ??? ??? ?? ???? ?????. ?? <is>? ???? ?? ?? ??? ????. <code>$n
$item-width
<figure></figure>
<div class="carousel"> <figure> <img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " /> <img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " /> ... <img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " /> </figure> </div>
???? ? ?? ????
? ? ??> ??? <<> ?? ?? ?? ?? <<> ?? ?? ?? ?? ?? ??? ???? ?? ?? ?? ?? ???? ??? ?????. ???? ??/?? ??? ?? ??? ?? ??? ? ??? ????? ?????. ? ??? ? ????.
??? ???? ??? ??? ? ??? ???? ???? ??? ?? ? ????. ???, ??? ???? ??? (SO ? ??>)?? ???? ?? ??? ???? ? ?? ??? ??? ?? ? ??>? 0?? ????? ?? ???
? ??> <<> JavaScript
<<> ? ?? ?? ??? ?????? : ? ??> : ? ??>? ???? ? ? ??? ?? ??? ?? ? ????.
??? ???? ?? ???? ???? ?????. ????? ????? ???? ??? ?????.
<div class="carousel">
<figure>
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
...
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
</figure>
</div>
($i - 1) * $theta
???? ??? ???? ? ??> ?? ? ??? ?????. $i
$theta = 2 * $PI / $n
<<> $PI
$theta
2 * $theta
???? ????? ? ?????.
<figure>
? ?????
???? ?? ??? ??? ????? ?? ????? ? ??? ??? ????
@for
? ??? ?? ?????. .carousel {
display: flex;
flex-direction: column;
align-items: center;
> * {
flex: 0 0 auto;
}
.figure {
width: $item-width;
transform-style: preserve-3d;
img {
width: 100%;
&:not(:first-of-type) {
display: none /* Just for now */
}
}
}
}
for...through
for...to
? ????, ??? ???? ??? "???"?? ??? ??? ??? ?????. ??? ???, ???? ??? ?? ???, 3D ?? ???? ?? ?? ??? ??? ????. ? ??? 3D ??? ??? ??????. ? ??? ??? ?? ???? ? ? ????. for...to
$i
#{}
? ??>
currImage
? ??> ???? ? ??> ??, ??? ??? ??? ??? ?? ???? ?????.
currImage
??? <div class="carousel">
<figure>
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
...
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
</figure>
</div>
<<> ??? ?? ???? ???? ???? ?? ?? ???? ???? ??? ?? ?? CSS ???? ?????. theta
?? 0?? ?????. , ?? ?? ????? ?? ??? ?? ???? ??????. ?? ???? ? ?? ??? ? ?? ?? ??? ???? ??? ??? ?????. .carousel {
display: flex;
flex-direction: column;
align-items: center;
> * {
flex: 0 0 auto;
}
.figure {
width: $item-width;
transform-style: preserve-3d;
img {
width: 100%;
&:not(:first-of-type) {
display: none /* Just for now */
}
}
}
}
? ??? ????? ???????. ? ??? ?? ???? ???? ????. -theta
? ??>? ???????
currImage
HTML5 Data-* ??? ??? ?? [0, numImages – 1]
currImage == n-1
currImage
??? ???? ???? ?????.
(n-1)*theta
? ??> currentImage
Number
??? ??
? ??>
?? ??. ??? ? ?? CodePen ??? ?? ? ?? ??? ?????. <div class="carousel">
<figure>
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
...
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/" class="lazy" alt="Building a 3D Rotating Carousel with CSS and JavaScript " />
</figure>
</div>
<figure>
data-gap
<<> ???? ? ?? ?? ?? ? ?? ??? ??? ?? ? ??? ???? ???? ?? ??? ???? ????.
dataset
setupCarousel()
getComputedStyle()
<,> ?? ??? ??? ????? ??? ?? ? ?? ??? ??????. (?? ??? ??? ????????) .carousel {
display: flex;
flex-direction: column;
align-items: center;
> * {
flex: 0 0 auto;
}
.figure {
width: $item-width;
transform-style: preserve-3d;
img {
width: 100%;
&:not(:first-of-type) {
display: none /* Just for now */
}
}
}
}
CSS ? JavaScript??? 3D ??? ??? ?????? ?? ? ?? FAQ
? ??? CSS ? JavaScript? 3D ?? ?? ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Node.js?? HTTP ??? ???? ? ?? ???? ??? ????. 1. ?? ????? ????? ??? ??? ? ?? ????? ?? ?? ? https.get () ??? ?? ??? ??? ? ?? ????? ?? ??? ?????. 2.axios? ??? ???? ? ?? ??????. ??? ??? ??? ??? ??? ??? ???/???, ?? JSON ??, ???? ?? ?????. ??? ?? ??? ????? ?? ????. 3. ?? ??? ??? ??? ??? ???? ???? ??? ??? ???? ?????.

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

?????, JavaScript ???! ?? ? JavaScript ??? ?? ?? ?????! ?? ?? ??? ??? ??? ? ????. Deno?? Oracle? ?? ??, ??? JavaScript ?? ??? ????, Google Chrome ???? ? ??? ??? ???? ?????. ?????! Deno Oracle? "JavaScript"??? ????? Oracle? ?? ??? ??? ??????. Node.js? Deno? ??? ? Ryan Dahl? ??? ?????? ???? ????? JavaScript? ??? ???? Oracle? ????? ???? ?????.

Cacheapi? ?????? ?? ???? ??? ???? ???, ?? ??? ??? ?? ???? ? ??? ?? ? ???? ??? ??????. 1. ???? ????, ??? ??, ?? ?? ?? ???? ???? ??? ? ????. 2. ??? ?? ?? ??? ?? ? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?????. 4. ??? ???? ?? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 5. ?? ???? ??, ??? ??? ? ??? ??, ?? ??? ? ?? ???? ???? ???? ? ?? ?????. 6.?? ??? ?? ?? ?? ??, ???? ?? ? HTTP ?? ????? ?????? ???????.

??? JavaScript?? ??? ??? ?????? ?? ???????. ?? ??, ?? ?? ? ??? ??? ?? ????? ????? ?????. 1. ?? ??? ??? ????? ???? ??. ()? ?? ??? ??? ?????. ?. ()? ?? ??? ?? ??? ??? ?? ? ? ????. 2. ?? ??? .catch ()? ???? ?? ??? ??? ?? ??? ??????, ??? ???? ???? ????? ??? ? ????. 3. Promise.all ()? ?? ????? (?? ?? ?? ? ??????? ??), Promise.Race () (? ?? ??? ?? ?) ? Promise.AllSettled () (?? ??? ???? ??)

.map (), .filter () ? .reduce ()? ?? JavaScript ?? ?? ???? ??? ??? ??? ? ? ????. 1) .map ()? ??? ??? ??? ???? ? ??? ???? ? ?????. 2) .filter ()? ???? ??? ????? ? ?????. 3) .reduce ()? ???? ?? ??? ???? ? ?????. ???? ??? ????? ??? ?? ?? ??? ?????.

JavaScript? ??? ??? ?? ??, ? ? ? ?? ???? ???? ??? ??? ?????. 1. ?? ??? ?? ??? ???? ??? ??? ??? ??? ?? WebAPI? ?????. 2. WebAPI? ??????? ??? ?? ? ? ??? ?? ??? (??? ?? ?? ???? ??)? ????. 3. ??? ??? ?? ??? ?? ??? ?????. ?? ??? ??? ????? ??? ??? ?? ? ???? ?????. 4. ???? ?? (? : Promise. 5. ??? ??? ???? ?? ???? ???? ?? ?? ?? ??? ????? ? ??????.

??? ??? ?? ???? ?? ??? ???? ?? ??? ??? ?? ??? ?? ??? ?????. 1. ??? ?? : ?? ??? ?? ? ? ???? ?? ??? ???? ??? ???? ??????. ?? ??, ??? ?? ? ? ?? ??? ?? ? ?? ??? ??????. 2. ??? ?? : ??? ???? ?? ?? ??? ?? ???? ????? ? ?? ?????? ???? ????? ? ?? ?? ??? true? ??????. 3. ?? ???? ?? ?? ??? ?? ??, ?? ??? ? ?? ???? ?????. 4. DOM ??? ???? ??, ?? ? ??? ? ??? ??? ?? ???? ?? ???? ?????.
