react实现圆环图文滚动幻灯片效果代码

代码语言:html

所属分类:幻灯片

代码描述:react实现圆环图文滚动幻灯片效果代码

代码标签: 图文 滚动 幻灯片 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  


  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@300;500&display=swap");
* {
  position: relative;
  box-sizing: border-box;
}

:root {
  --duration: 0.8s;
  --color-purple: #828dd6;
}

html {
  font-size: clamp(11px, 2vmin, 18px);
}

html,
body {
  height: 100%;
  padding: 0;
  margin: 0;
  font-family: Raleway, sans-serif;
  overflow: hidden;
}

body {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: #23274a;
  color: white;
  text-shadow: 0 2px 0 #000;
}

img {
  max-width: 100%;
}

.app {
  display: grid;
  grid-template-columns: 10% 1fr 10%;
  grid-template-rows: 1fr;
}
.app > .dashes {
  margin: -1rem;
  stroke: var(--color-purple);
  stroke-linecap: round;
  stroke-width: 0.6;
  -webkit-animation: rotate 15s linear infinite;
          animation: rotate 15s linear infinite;
}
@-webkit-keyframes rotate {
  to {
    transform: rotate(1turn);
  }
}
@keyframes rotate {
  to {
    transform: rotate(1turn);
  }
}
.app > .dashes,
.app > .slide {
  grid-column: 1/-1;
  grid-row: 1/-1;
}
.app > .button.-next {
  grid-column: -2/-1;
  grid-row: 1/-1;
  align-self: center;
}

.slide {
  padding: 2rem;
  --radius: 35vw;
  width: calc(var(--radius) * 2);
  height: calc(var(--radius) * 2);
  display: grid;
  grid-template-areas: "layer";
  place-items: center;
  --default-animation: fade-in;
  --name-animation: name-enter;
  --image-animation: image-enter;
  --stat-animation: stat-enter;
  --quote-animation: quote-enter;
  --delay: var(--duration);
}
.slide > * {
  grid-area: layer;
  -webkit-animation: var(--default-animation) var(--duration) ease-in-out var(--delay) both;
          animation: var(--default-animation) var(--duration) ease-in-out var(--delay) both;
}
.slide > .slide-name {
  align-self: end;
  z-index: 2;
}
.slide[data-previous] {
  z-index: 2;
  --default-animation: fade-out;
  --name-animation: name-exit;
  --image-animation: image-exit;
  --stat-animation: stat-exit;
  --quote-animation: quote-exit;
  --delay: 0s;
}

@-webkit-keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@-webkit-keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
.slide-name {
  text-align: center;
  font-size: 4.5rem;
  --default-animation: var(--name-animation);
}

.slide-image {
  --default-animation: var(--image-animation);
}

.slide-stat {
  --default-animation: var(--stat-animation);
}

.slide-quote {
  --default-animation: var(--quote-animation);
}

@-webkit-keyframes name-enter {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes name-enter {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@-webkit-keyframes name-exit {
  from {
    transform: none;
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}
@keyframes name-exit {
  from {
    transform: none;
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}
@-webkit-keyframes image-enter {
  from {
    transform: scale(1.2);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes image-enter {
  from {
    transform: scale(1.2);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@-webkit-keyframes image-exit {
  from {
    transform: none;
    opacity: 1;
  }
  to {
    transform: scale(0.7);
    opacity: 0;
  }
}
@keyframes image-exit {
  from {
    transform: none;
    opacity: 1;
  }
  to {
    transform: scale(0.7);
    opacity: 0;
  }
}
@property --r-offset {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0turn;
}
@-webkit-keyframes stat-enter {
  from {
    --r-offset: -0.5turn;
    opacity: 0;
  }
}
@keyframes stat-enter {
  from {
    --r-offset: -0.5turn;
    opacity: 0;
  }
}
@-webkit-keyframes stat-exit {
  to {
    --r-offset: -0.3turn;
    opacity: 0;
  }
}
@keyframes stat-exit {
  to {
    --r-offset: -0.3turn;
    opacity: 0;
  }
}
@-webkit-keyframes quote-enter {
  from {
    transform: translate(75%, -150%) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translate(100%, -200%);
    opacity: 1;
  }
}
@keyframes quote-enter {
  from {
    transform: translate(75%, -150%) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translate(100%, -200%);
    opacity: 1;
  }
}
@-webkit-keyframes quote-exit {
  from {
    transform: translate(100%, -200%);
    opacity: 1;
  }
  to {
    transform: translate(75%, -150%) scale(0.8);
    opacity: 0;
  }
}
@keyframes quote-exit {
  from {
    transform: translate(100%, -200%);
    opacity: 1;
  }
  to {
    transform: translate(75%, -150%) scale(0.8);
    opacity: 0;
  }
}
.slide-image {
  border-radius: 100vw;
  box-shadow: 0 0.5rem 2rem #0007;
}

.slide-stat,
.slide-quote {
  --transform: rotate(var(--r)) translate(var(--radius))
    rotate(calc(-1 * var(--r)));
  transform: var(--transform);
}

.slide-quote {
  top: 0;
  left: 0;
  box-shadow: 0 1rem 2rem #000a;
  min-width: 15rem;
}

.slide-stat {
  display: inline-block;
  color: #fff;
  max-width: 16em;
  z-index: 3;
  --d: calc(var(--i) / var(--stats));
  --r-offset: -0.4turn;
  --r: calc(var(--r-offset) + (-0.3turn * var(--d)));
}
.slide-stat:last-of-type {
  --r: calc(var(--r-offset) + 0.45turn);
}

.slide-quote {
  background: linear-gradient(45deg, #23274a, #33396d);
  padding: 1rem;
  font-size: 0.8rem;
  line-height: 1.6;
  max-width: 12em;
  --r: 0.9turn;
}

.stat-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0.7;
  letter-spacing: 0.5ch;
  white-space: nowrap;
  font-weight: bold;
}

.stat-value {
  font-size: 2rem;
}

.button {
  z-index: 999999;
  text-transform: uppercase;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background: white;
  color: #1b1d3a;
  font-weight: bold;
  height: 12vmin;
  width: 12vmin;
  border-radius: 50%;
  border: none;
  opacity: 0.3;
  transition: opacity 0.3s ease;
  line-height: 1.5;
}
.button:hover {
  cursor: pointer;
  opacity: 1;
}
</style>


</head>

<body >


<div id="root"></div>

<script>
  const slides = [{
      image: "//repo.bfw.wiki/bfwrepo/image/5e0c6f70b0216.........完整代码请登录后点击上方下载按钮下载查看

网友评论0