css模拟手机滚动动画效果

代码语言:html

所属分类:动画

代码描述:css模拟手机滚动动画效果

代码标签: 滚动 动画 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
:root {
  --col-metal-light: #f2f2f2;
  --col-metal-medium: #a6a6a6;
  --col-metal-dark: #737373;
  --grad-1: 0deg, var(--col-metal-dark) 0%, var(--col-metal-light) 50%,
    var(--col-metal-dark);
  --grad-2: 45deg, black 0%, var(--col-metal-dark) 50%, var(--col-metal-light);
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  background-image: repeating-linear-gradient(
    45deg,
    #004c66,
    #004c66 1em,
    #306880 1em,
    #306880 50%
  );
  background-size: 5em 5em;
}
.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rim {
  width: 240px;
  height: 440px;
  background: red;
  border-radius: 18px;
  background: linear-gradient(var(--grad-1));
  box-shadow: 0px 3px 21px rgba(0, 0, 0, 0.7);
  
    animation-name: rotate-phone;
  animation-duration: 3s;
  animation-delay: 0;
  animation-fill-mode: both;
  animation-direction: alternate;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
.rim2 {
  width: 234px;
  height: 434px;
  background: red;
  border-radius: 1em;
  background: linear-gradient(var(--grad-2));
}

.face {
  width: 228px;
  height: 428px;
  background: red;
  border-radius: 13px;
  background: linear-gradient(
    0deg,
    rgba(37, 37, 37, 1) 0%,
    rgba(65, 65, 65, 1) 18%,
    rgba(14, 14, 14, 1) 100%
  );
  box-shadow: inset rgba(0, 0, 0, 0.78) 0px 0px 5px;
  position: relative;
}

.light{
  position: absolute;
  width: 10px;
  height: 10px;
  background:#6eff3a;
  border-radius: 10px;
  display: block;
  top:10px;
  right:26px;
  
  animation-name: flash;
   animation-direction: alternate;
  animation-duration: 1s;
  animation-delay: 0;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

.speaker {
  position: absolute;
  width: 100px;
  height: 10px;
  background: red;
  display: block;
  border-radius: 10px;
  top: 10px;
  background: linear-gradient(
    0deg,
    rgba(37, 37, 37, 1) 0%,
    rgba(65, 65, 65, 1) 18%,
    black 100%
  );
  border-bottom: 1px solid var(--col-metal-medium);
}

.screen {
  width: 210px;
  height: 370px;
  background: white;
  overflow: hidden;
}

.content {
  animation-name: content-scroll;
  animation-duration: 8s;
  animation-delay: 0;
  animation-fill-mode: both;
  animation-direction: alternate;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.paragraph{
  margin:1em;
}

.line1{
  width:10em;
  height:10px;
  background:var(--col-metal-dark);
  border-radius:10px;
  margin-bottom:1em;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0