@@ -29,7 +29,7 @@ import SmoothButton from "./SmoothButton.astro";
2929 <!-- 大标题 -->
3030 <h1
3131 class =" text-2xl sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl text-white text-center z-10 !leading-snug" >
32- 一站式 AI / 函数 / 应用 <br >开发平台
32+ 一站式 < span id = " typingText " ></ span > <br >开发平台
3333 </h1 >
3434
3535 <!-- 详细描述 -->
@@ -55,7 +55,6 @@ import SmoothButton from "./SmoothButton.astro";
5555 </main >
5656</Container >
5757
58-
5958<script >
6059 import {BreathingColor} from '@b-design/color';
6160
@@ -76,6 +75,21 @@ import SmoothButton from "./SmoothButton.astro";
7675 "symbolColor": "#6483FF"
7776 }
7877
78+ document.addEventListener('DOMContentLoaded', function() {
79+ const text = 'AI / 函数 / 应用';
80+ const typingText = document.getElementById('typingText');
81+ let index = 0;
82+
83+ function typeWriter() {
84+ if (index < text.length) {
85+ typingText.textContent += text.charAt(index);
86+ index++;
87+ setTimeout(typeWriter, 200); // 每200毫秒显示一个字符
88+ }
89+ }
90+
91+ typeWriter();
92+ });
7993 document.addEventListener('DOMContentLoaded', () => {
8094 animateBackground = document.querySelector('.hero-background');
8195
@@ -127,8 +141,24 @@ import SmoothButton from "./SmoothButton.astro";
127141 };
128142</script >
129143
130-
131144<style >
145+ @keyframes typing {
146+ from { width: 0; }
147+ to { width: 100%; }
148+ }
149+
150+ @keyframes blink-caret {
151+ from, to { border-color: transparent; }
152+ 50% { border-color: #fff; }
153+ }
154+
155+ #typingText {
156+ overflow: hidden;
157+ white-space: nowrap;
158+ border-right: 2px solid #fff; /* 打字机光标 */
159+ animation: typing 2s steps(13, end), blink-caret .75s step-end infinite;
160+ }
161+
132162 .hero-background {
133163 position: absolute;
134164 z-index: -10000;
@@ -143,4 +173,4 @@ import SmoothButton from "./SmoothButton.astro";
143173 background: linear-gradient(180deg, rgba(18, 19, 22, 1) 0%, rgba(18, 19, 22, 0) 100%),
144174 linear-gradient(135deg, rgba(26, 121, 255, 1) 0%, rgba(155, 106, 255, 1) 100%);
145175 }
146- </style >
176+ </style >
0 commit comments