css+js布局实现健身类app ui界面交互效果代码

代码语言:html

所属分类:布局界面

代码描述:css+js布局实现健身类app ui界面交互效果代码

代码标签: css js 布局 健身 app ui 界面 交互

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

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

<head>
 
<meta charset="UTF-8">
 
 
 
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

body {
  background: #2a2a2a;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.phone-frame {
  width: 375px;
  height: 800px;
  background: #111;
  border-radius: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 12px;
  position: relative;
  overflow: hidden;
}

.notch {
  position: absolute;
  width: 180px;
  height: 28px;
  background: #111;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  z-index: 100;
}

.home-indicator {
  position: absolute;
  width: 140px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px;
  z-index: 100;
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 30px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(160deg, #0A1128, #001F54);
}

.container {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  color: #ffffff;
  position: relative;
  padding: 40px 20px 90px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.container::-webkit-scrollbar {
  display: none;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 25px;
  font-size: 14px;
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  z-index: 10;
}

.time {
  font-weight: 600;
  color: white;
}

.status-icons {
  display: flex;
  gap: 6px;
}

.status-icons svg {
  color: white;
  fill: white;
  stroke: white;
}

.battery svg rect {
  stroke: white;
}

.battery svg rect:nth-child(2) {
  fill: white;
}

.date {
  font-size: 16px;
  opacity: 0.9;
  text-align: center;
  margin: 20px 0 10px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 5px;
}

.app-title {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(90deg, #4CC9F0, #4361EE);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(45deg, #4361EE, #4CC9F0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
}

.progress-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px 0 25px;
}

.progress-container {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-circle {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.progress-fill {
  stroke: #4CC9F0;
  stroke-dasharray: 553;
  stroke-dashoffset: 553;
  transition: stroke-dashoffset 1.5s ease-out;
}

.progress-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.step-count {
  font-size: 40px;
  font-weight: 700;
}

.step-label {
  font-size: 16px;
  opacity: 0.8;
}

.step-goal {
  margin-top: 5px;
  font-size: 14px;
  opacity: 0.6;
}

.activity-stats {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 15px;
  padding: 0 10px;
}

.activity-stat {
  text-align: center;
}

.activity-stat .stat-value {
  font-size: 20px;
  font-weight: 600;
}

.activity-stat .stat-label {
  font-size: 12px;
  opacity: 0.7;
}

.weekly-chart {
  margin-bottom: 25px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
}

.chart-controls {
  display: flex;
  gap: 5px;
}

.chart-button {
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-button.active {
  background: rgba(77, 201, 240, 0.3);
}

.chart-container {
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 10px;
}

.chart-bar {
  width: 28px;
  background: rgba(77, 201, 240, 0.2);
  border-radius: 6px;
  position: relative;
  transition: height 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s ease;
}

.chart-bar.active {
  background: linear-gradient(to top, #4361EE, #4CC9F0);
}

.mon-bar {
  height: 65%;
}

.tue-bar {
  height: 55%;
}

.wed-bar {
  height: 90%;
}

.thu-bar {
  height: 75%;
}

.fri-bar {
  height: 95%;
}

.sat-bar {
  height: 50%;
}

.sun-bar {
  height: 74%;
}

.day-label {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  opacity: 0.7;
}

.bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  opacity: 0;
}

.chart-bar:active {
  background-color: rgba(77, 201, 240, 0.4);
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 15px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeIn 0.5s ease forwards;
  opacity: 0;
  transform: translateY(10px);
}

.card:active {
  transform: scale(0.98);
  background-color: rgba(255, 255, 255, 0.12);
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:nth-child(1) {
  animation-delay: 0.1s;
}

.card:nth-child(2) {
  animation-delay: 0.2s;
}

.card:nth-child(3) {
  animation-delay: 0.3s;
}

.card:nth-child(4) {
  animation-delay: 0.4s;
}

.card:nth-child(5) {
  animation-delay: 0.5s;
}

.sleep-card {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(76, 201, 240, 0.1));
}

.sleep-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.sleep-icon-container {
  width: 40px;
  height: 40px;
  background: rgba(67, 97, 238, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
}

.sleep-info .sleep-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.sleep-info .sleep-time {
  font-size: 14px;
  opacity: 0.7;
}

.progress-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.sleep-progress {
  height: 100%;
  width: 85%;
  background: #4361EE;
  border-radius: 3px;
}

.sleep-score {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.score-label {
  opacity: 0.7;
}

.score-value {
  font-weight: 500;
}

.recommendation-card {
  background: linear-gradient(45deg, rgba(77, 201, 240, 0.2), rgba(67, 97, 238, 0.2));
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 16px;
}

.recommendation-icon {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recommendation-content {
  flex: 1;
}

.recommendation-title {
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 16px;
}

.recommendation-text {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 10px;
}

.recommendation-action {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(77, 201, 240, 0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.weekly-challenge {
  background: linear-gradient(135deg, rgba(114, 9, 183, 0.1), rgba(247, 37, 133, 0.1));
  margin-top: 15px;
  padding: 15px;
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.challenge-title {
  font-weight: 600;
  font-size: 16px;
}

.challenge-days-left {
  background: rgba(247, 37, 133, 0.2);
  color: #F72585;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.challenge-description {
  font-size: 14px;
  margin-bottom: 15px;
}

.challenge-progress-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.challenge-progress-bar {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-right: 10px;
}

.challenge-progress-fill {
  height: 100%;
  width: 60%;
  background: linear-gradient(90deg, #7209B7, #F72585);
  border-radius: 4px;
}

.challenge-progress-text {
  font-weight: 600;
  font-size: 14px;
}

.challenge-button {
  width: 100%;
  background: rgba(247, 37, 133, 0.25);
  border: none;
  color: white;
  padding: 10px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 14px;
}

.workout-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin-bottom: 25px;
}

.workout-card {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.workout-card:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.15);
}

.workout-icon {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(77, 201, 240, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  transition: all 0.3s ease;
}

.workout-info {
  flex: 1;
}

.workout-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.workout-meta {
  display: flex;
  gap: 12px;
  font-size: 14px;
  opacity: 0.8;
}

#add-workout .workout-icon {
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.achievements {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 25px;
}

.achievement {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 15px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  opacity: 0.5;
}

.achievement.unlocked {
  opacity: 1;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.achievement-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(77, 201, 240, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.achievement.unlocked .achievement-icon {
  background: rgba(77, 201, 240, 0.3);
}

.achievement-name {
  font-size: 12px;
  text-align: center;
  font-weight: 500;
}

.achievement.newly-unlocked {
  animation: highlight 2s ease;
}

@keyframes highlight {

  0%,
  100% {
    background: rgba(255, 255, 255, 0.13);
  }

  50% {
    background: rgba(76, 201, 240, 0.3);
  }
}

.bottom-nav {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 60px);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  z-index: 50;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-item {
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0