commit c01ee4f3e89afe42538d114c52d5845cc77edba3
Author: root <root@hub.scroll.pub> Date: 2024-12-31 02:35:39 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..0733a0b --- /dev/null +++ b/body.html @@ -0,0 +1,53 @@ +<header> + <h1>Interactive Milestone Timeline</h1> +</header> + +<main> + <div class="timeline-container"> + <div class="progress-bar"> + <div class="progress-fill"></div> + </div> + + <div class="milestones"> + <div class="milestone" data-date="2023-01"> + <div class="milestone-dot"></div> + <div class="milestone-content"> + <h3>Project Start</h3> + <p>Initial planning phase</p> + </div> + </div> + + <div class="milestone" data-date="2023-04"> + <div class="milestone-dot"></div> + <div class="milestone-content"> + <h3>Phase 1 Complete</h3> + <p>Development milestone reached</p> + </div> + </div> + + <div class="milestone" data-date="2023-07"> + <div class="milestone-dot"></div> + <div class="milestone-content"> + <h3>Beta Launch</h3> + <p>Public beta testing begins</p> + </div> + </div> + + <div class="milestone" data-date="2023-12"> + <div class="milestone-dot"></div> + <div class="milestone-content"> + <h3>Final Release</h3> + <p>Project completion</p> + </div> + </div> + </div> + </div> + + <div class="controls"> + <button id="animate-progress">Animate Progress</button> + </div> +</main> + +<footer> + <p>Created with passion by Milestone Timeline</p> +</footer> diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..515d202 --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://milestone-timeline.scroll.pub +metaTags +editButton /edit.html +title Interactive Milestone Timeline +style.css +body.html +script.js diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..d68555d --- /dev/null +++ b/prompt.json @@ -0,0 +1,20 @@ +{ + "id": "msg_01H1sab1AG8oPL7YCeMp2XJN", + "type": "message", + "role": "assistant", + "model": "claude-3-5-sonnet-20241022", + "content": [ + { + "type": "text", + "text": "I'll create a website for a milestone progress bar.\n\n---domain---\nmilestone-timeline.scroll.pub\n\n---index.scroll---\nbuildHtml\nbaseUrl https://milestone-timeline.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Interactive Milestone Timeline\nstyle.css\nbody.html\nscript.js\n\n---body.html---\n<header>\n <h1>Interactive Milestone Timeline</h1>\n</header>\n\n<main>\n <div class=\"timeline-container\">\n <div class=\"progress-bar\">\n <div class=\"progress-fill\"></div>\n </div>\n \n <div class=\"milestones\">\n <div class=\"milestone\" data-date=\"2023-01\">\n <div class=\"milestone-dot\"></div>\n <div class=\"milestone-content\">\n <h3>Project Start</h3>\n <p>Initial planning phase</p>\n </div>\n </div>\n\n <div class=\"milestone\" data-date=\"2023-04\">\n <div class=\"milestone-dot\"></div>\n <div class=\"milestone-content\">\n <h3>Phase 1 Complete</h3>\n <p>Development milestone reached</p>\n </div>\n </div>\n\n <div class=\"milestone\" data-date=\"2023-07\">\n <div class=\"milestone-dot\"></div>\n <div class=\"milestone-content\">\n <h3>Beta Launch</h3>\n <p>Public beta testing begins</p>\n </div>\n </div>\n\n <div class=\"milestone\" data-date=\"2023-12\">\n <div class=\"milestone-dot\"></div>\n <div class=\"milestone-content\">\n <h3>Final Release</h3>\n <p>Project completion</p>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"controls\">\n <button id=\"animate-progress\">Animate Progress</button>\n </div>\n</main>\n\n<footer>\n <p>Created with passion by Milestone Timeline</p>\n</footer>\n\n---style.css---\n:root {\n --primary-color: #2196f3;\n --secondary-color: #1976d2;\n --background-color: #f5f5f5;\n --text-color: #333;\n --milestone-size: 20px;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: 'Segoe UI', system-ui, sans-serif;\n line-height: 1.6;\n color: var(--text-color);\n background-color: var(--background-color);\n}\n\nheader {\n text-align: center;\n padding: 2rem;\n background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));\n color: white;\n}\n\nmain {\n max-width: 1200px;\n margin: 2rem auto;\n padding: 0 1rem;\n}\n\n.timeline-container {\n position: relative;\n margin: 4rem 0;\n}\n\n.progress-bar {\n position: absolute;\n top: var(--milestone-size);\n left: 0;\n width: 100%;\n height: 4px;\n background-color: #ddd;\n border-radius: 2px;\n}\n\n.progress-fill {\n width: 0;\n height: 100%;\n background-color: var(--primary-color);\n border-radius: 2px;\n transition: width 1.5s ease-in-out;\n}\n\n.milestones {\n position: relative;\n padding-top: var(--milestone-size);\n}\n\n.milestone {\n position: absolute;\n transform: translateX(-50%);\n}\n\n.milestone-dot {\n width: var(--milestone-size);\n height: var(--milestone-size);\n background-color: white;\n border: 4px solid var(--primary-color);\n border-radius: 50%;\n position: absolute;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n transition: background-color 0.3s;\n}\n\n.milestone.active .milestone-dot {\n background-color: var(--primary-color);\n}\n\n.milestone-content {\n position: absolute;\n top: calc(var(--milestone-size) + 1rem);\n left: 50%;\n transform: translateX(-50%);\n background: white;\n padding: 1rem;\n border-radius: 8px;\n box-shadow: 0 2px 8px rgba(0,0,0,0.1);\n width: 200px;\n opacity: 0;\n transition: opacity 0.3s;\n}\n\n.milestone.active .milestone-content {\n opacity: 1;\n}\n\n.controls {\n text-align: center;\n margin-top: 3rem;\n}\n\nbutton {\n background-color: var(--primary-color);\n color: white;\n border: none;\n padding: 0.8rem 1.5rem;\n border-radius: 4px;\n cursor: pointer;\n font-size: 1rem;\n transition: background-color 0.3s;\n}\n\nbutton:hover {\n background-color: var(--secondary-color);\n}\n\nfooter {\n text-align: center;\n padding: 2rem;\n margin-top: 2rem;\n background-color: #fff;\n}\n\n@media (max-width: 768px) {\n .milestone-content {\n width: 150px;\n font-size: 0.9rem;\n }\n}\n\n---script.js---\ndocument.addEventListener('DOMContentLoaded', () => {\n const milestones = document.querySelectorAll('.milestone');\n const progressFill = document.querySelector('.progress-fill');\n const animateButton = document.getElementById('animate-progress');\n\n // Position milestones along the timeline\n milestones.forEach((milestone, index) => {\n const position = (index / (milestones.length - 1)) * 100;\n milestone.style.left = `${position}%`;\n });\n\n // Animation function\n function animateProgress() {\n let progress = 0;\n progressFill.style.width = '0%';\n \n // Reset all milestones\n milestones.forEach(milestone => {\n milestone.classList.remove('active');\n });\n\n const animation = setInterval(() => {\n progress += 1;\n progressFill.style.width = `${progress}%`;\n\n // Activate milestones as progress passes them\n milestones.forEach((milestone, index) => {\n const position = (index / (milestones.length - 1)) * 100;\n if (progress >= position) {\n milestone.classList.add('active');\n }\n });\n\n if (progress >= 100) {\n clearInterval(animation);\n }\n }, 20);\n }\n\n // Add click event to button\n animateButton.addEventListener('click', animateProgress);\n\n // Initial animation\n setTimeout(animateProgress, 1000);\n});\n\n---end---\n\nThis implementation creates a beautiful, interactive milestone timeline with the following features:\n\n1. Smooth progress bar animation\n2. Milestone dots that light up as progress passes them\n3. Info cards that fade in for each milestone\n4. Responsive design that works on mobile devices\n5. Clean, modern UI with subtle animations and shadows\n6. Restart animation button\n7. Accessible and semantic HTML structure\n8. Custom CSS variables for easy theming\n9. Smooth transitions and animations\n\nThe timeline automatically positions milestones evenly across the bar and animates them sequentially. Users can restart the animation at any time using the button. The design is professional and polished, with attention to details like hover states, shadows, and spacing." + } + ], + "stop_reason": "end_turn", + "stop_sequence": null, + "usage": { + "input_tokens": 290, + "cache_creation_input_tokens": 0, + "cache_read_input_tokens": 0, + "output_tokens": 1989 + } +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..cd8602b --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# milestone-timeline.scroll.pub +Website generated by Claude from prompt: 设计一个进度条,进度条上插入里程碑事件 \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..b8bf7cd --- /dev/null +++ b/script.js @@ -0,0 +1,45 @@ +document.addEventListener('DOMContentLoaded', () => { + const milestones = document.querySelectorAll('.milestone'); + const progressFill = document.querySelector('.progress-fill'); + const animateButton = document.getElementById('animate-progress'); + + // Position milestones along the timeline + milestones.forEach((milestone, index) => { + const position = (index / (milestones.length - 1)) * 100; + milestone.style.left = `${position}%`; + }); + + // Animation function + function animateProgress() { + let progress = 0; + progressFill.style.width = '0%'; + + // Reset all milestones + milestones.forEach(milestone => { + milestone.classList.remove('active'); + }); + + const animation = setInterval(() => { + progress += 1; + progressFill.style.width = `${progress}%`; + + // Activate milestones as progress passes them + milestones.forEach((milestone, index) => { + const position = (index / (milestones.length - 1)) * 100; + if (progress >= position) { + milestone.classList.add('active'); + } + }); + + if (progress >= 100) { + clearInterval(animation); + } + }, 20); + } + + // Add click event to button + animateButton.addEventListener('click', animateProgress); + + // Initial animation + setTimeout(animateProgress, 1000); +}); diff --git a/style.css b/style.css new file mode 100644 index 0000000..f933886 --- /dev/null +++ b/style.css @@ -0,0 +1,135 @@ +:root { + --primary-color: #2196f3; + --secondary-color: #1976d2; + --background-color: #f5f5f5; + --text-color: #333; + --milestone-size: 20px; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Segoe UI', system-ui, sans-serif; + line-height: 1.6; + color: var(--text-color); + background-color: var(--background-color); +} + +header { + text-align: center; + padding: 2rem; + background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); + color: white; +} + +main { + max-width: 1200px; + margin: 2rem auto; + padding: 0 1rem; +} + +.timeline-container { + position: relative; + margin: 4rem 0; +} + +.progress-bar { + position: absolute; + top: var(--milestone-size); + left: 0; + width: 100%; + height: 4px; + background-color: #ddd; + border-radius: 2px; +} + +.progress-fill { + width: 0; + height: 100%; + background-color: var(--primary-color); + border-radius: 2px; + transition: width 1.5s ease-in-out; +} + +.milestones { + position: relative; + padding-top: var(--milestone-size); +} + +.milestone { + position: absolute; + transform: translateX(-50%); +} + +.milestone-dot { + width: var(--milestone-size); + height: var(--milestone-size); + background-color: white; + border: 4px solid var(--primary-color); + border-radius: 50%; + position: absolute; + top: 0; + left: 50%; + transform: translateX(-50%); + transition: background-color 0.3s; +} + +.milestone.active .milestone-dot { + background-color: var(--primary-color); +} + +.milestone-content { + position: absolute; + top: calc(var(--milestone-size) + 1rem); + left: 50%; + transform: translateX(-50%); + background: white; + padding: 1rem; + border-radius: 8px; + box-shadow: 0 2px 8px rgba(0,0,0,0.1); + width: 200px; + opacity: 0; + transition: opacity 0.3s; +} + +.milestone.active .milestone-content { + opacity: 1; +} + +.controls { + text-align: center; + margin-top: 3rem; +} + +button { + background-color: var(--primary-color); + color: white; + border: none; + padding: 0.8rem 1.5rem; + border-radius: 4px; + cursor: pointer; + font-size: 1rem; + transition: background-color 0.3s; +} + +button:hover { + background-color: var(--secondary-color); +} + +footer { + text-align: center; + padding: 2rem; + margin-top: 2rem; + background-color: #fff; +} + +@media (max-width: 768px) { + .milestone-content { + width: 150px; + font-size: 0.9rem; + } +}