eaglelandsonce commited on
Commit
c7c9136
·
verified ·
1 Parent(s): c4e6c19

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +250 -19
index.html CHANGED
@@ -1,19 +1,250 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>CI/CD Trigger Simulation</title>
6
+ <style>
7
+ body { margin: 0; overflow: hidden; font-family: 'Segoe UI', sans-serif; background-color: #1a1a2e; color: white; }
8
+ #controls {
9
+ position: absolute;
10
+ top: 20px;
11
+ left: 20px;
12
+ background: rgba(255, 255, 255, 0.1);
13
+ padding: 20px;
14
+ border-radius: 8px;
15
+ backdrop-filter: blur(5px);
16
+ border: 1px solid rgba(255, 255, 255, 0.2);
17
+ }
18
+ h1 { margin-top: 0; font-size: 1.2rem; color: #e94560; }
19
+ p { font-size: 0.9rem; color: #ccc; margin-bottom: 15px; }
20
+ button {
21
+ display: block;
22
+ width: 100%;
23
+ padding: 10px;
24
+ margin-bottom: 10px;
25
+ border: none;
26
+ border-radius: 4px;
27
+ cursor: pointer;
28
+ font-weight: bold;
29
+ transition: transform 0.1s;
30
+ }
31
+ button:active { transform: scale(0.98); }
32
+ .btn-commit { background-color: #4cc9f0; color: #000; }
33
+ .btn-schedule { background-color: #f72585; color: white; }
34
+ .btn-manual { background-color: #ffd60a; color: #000; }
35
+
36
+ /* Labels in 3D space */
37
+ .label {
38
+ position: absolute;
39
+ color: white;
40
+ font-size: 12px;
41
+ background: rgba(0,0,0,0.6);
42
+ padding: 4px 8px;
43
+ border-radius: 4px;
44
+ pointer-events: none;
45
+ }
46
+ </style>
47
+ </head>
48
+ <body>
49
+
50
+ <div id="controls">
51
+ <h1>CI/CD Trigger Control</h1>
52
+ <p>Activate a trigger to start the pipeline:</p>
53
+ <button class="btn-commit" onclick="triggerPipeline('commit')">simulate Code Commit &lt;/&gt;</button>
54
+ <button class="btn-schedule" onclick="triggerPipeline('schedule')">simulate Schedule (Timer)</button>
55
+ <button class="btn-manual" onclick="triggerPipeline('manual')">simulate Manual Approval</button>
56
+ </div>
57
+
58
+ <div id="canvas-container"></div>
59
+
60
+ <script type="module">
61
+ import * as THREE from 'https://unpkg.com/three@0.160.0/build/three.module.js';
62
+
63
+ // --- SCENE SETUP ---
64
+ const scene = new THREE.Scene();
65
+ scene.background = new THREE.Color(0x1a1a2e); // Dark Navy
66
+
67
+ const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
68
+ camera.position.set(0, 10, 20);
69
+ camera.lookAt(0, 0, 0);
70
+
71
+ const renderer = new THREE.WebGLRenderer({ antialias: true });
72
+ renderer.setSize(window.innerWidth, window.innerHeight);
73
+ document.getElementById('canvas-container').appendChild(renderer.domElement);
74
+
75
+ // Lights
76
+ const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
77
+ scene.add(ambientLight);
78
+ const dirLight = new THREE.DirectionalLight(0xffffff, 1);
79
+ dirLight.position.set(5, 10, 7);
80
+ scene.add(dirLight);
81
+
82
+ // --- MATERIALS & GEOMETRY ---
83
+ const matTrigger = new THREE.MeshStandardMaterial({ color: 0x4cc9f0 }); // Blue
84
+ const matSchedule = new THREE.MeshStandardMaterial({ color: 0xf72585 }); // Pink
85
+ const matManual = new THREE.MeshStandardMaterial({ color: 0xffd60a }); // Yellow
86
+ const matPipeline = new THREE.MeshStandardMaterial({ color: 0xb5179e }); // Purple/Red
87
+ const matOutput = new THREE.MeshStandardMaterial({ color: 0x2ec4b6 }); // Teal
88
+
89
+ // --- OBJECTS ---
90
+
91
+ // 1. Inputs (Left Side)
92
+ const commitNode = createBox(-6, 0, -3, matTrigger, "Commit");
93
+ const scheduleNode = createBox(-6, 0, 0, matSchedule, "Schedule");
94
+ const manualNode = createBox(-6, 0, 3, matManual, "Manual");
95
+
96
+ // 2. Central Pipeline (Center)
97
+ const pipelineGeo = new THREE.CylinderGeometry(1.5, 1.5, 6, 32);
98
+ pipelineGeo.rotateZ(Math.PI / 2); // Lay flat
99
+ const pipeline = new THREE.Mesh(pipelineGeo, matPipeline);
100
+ scene.add(pipeline);
101
+
102
+ // 3. Outputs (Right Side)
103
+ const buildNode = createBox(6, 0, -2, matOutput, "Build & Test");
104
+ const deployNode = createBox(6, 0, 2, matOutput, "Deploy");
105
+
106
+ // 4. Connectors (Lines)
107
+ drawPath(commitNode.position, new THREE.Vector3(-3, 0, 0));
108
+ drawPath(scheduleNode.position, new THREE.Vector3(-3, 0, 0));
109
+ drawPath(manualNode.position, new THREE.Vector3(-3, 0, 0));
110
+ drawPath(new THREE.Vector3(3, 0, 0), buildNode.position);
111
+ drawPath(new THREE.Vector3(3, 0, 0), deployNode.position);
112
+
113
+ // --- DATA PARTICLES ---
114
+ const particles = [];
115
+
116
+ function createBox(x, y, z, material, name) {
117
+ const geo = new THREE.BoxGeometry(1.5, 1.5, 1.5);
118
+ const mesh = new THREE.Mesh(geo, material);
119
+ mesh.position.set(x, y, z);
120
+ scene.add(mesh);
121
+
122
+ // Add simple floating text label (using HTML overlay technique logic for simplicity in positioning)
123
+ addLabel(name, x, y + 1.2, z);
124
+ return mesh;
125
+ }
126
+
127
+ function drawPath(start, end) {
128
+ const points = [start, end];
129
+ const geometry = new THREE.BufferGeometry().setFromPoints(points);
130
+ const material = new THREE.LineBasicMaterial({ color: 0xffffff, opacity: 0.3, transparent: true });
131
+ const line = new THREE.Line(geometry, material);
132
+ scene.add(line);
133
+ }
134
+
135
+ function addLabel(text, x, y, z) {
136
+ const div = document.createElement('div');
137
+ div.className = 'label';
138
+ div.textContent = text;
139
+ document.body.appendChild(div);
140
+
141
+ // We attach position data to the div to update it in the render loop
142
+ div.dataset.x = x;
143
+ div.dataset.y = y;
144
+ div.dataset.z = z;
145
+ }
146
+
147
+ // --- ANIMATION LOGIC ---
148
+
149
+ window.triggerPipeline = (type) => {
150
+ let startPos, color, destination;
151
+
152
+ if (type === 'commit') {
153
+ startPos = commitNode.position.clone();
154
+ color = 0x4cc9f0;
155
+ destination = buildNode.position.clone();
156
+ } else if (type === 'schedule') {
157
+ startPos = scheduleNode.position.clone();
158
+ color = 0xf72585;
159
+ destination = buildNode.position.clone();
160
+ } else if (type === 'manual') {
161
+ startPos = manualNode.position.clone();
162
+ color = 0xffd60a;
163
+ destination = deployNode.position.clone();
164
+ }
165
+
166
+ // Create a packet
167
+ const geo = new THREE.SphereGeometry(0.4, 16, 16);
168
+ const mat = new THREE.MeshBasicMaterial({ color: color });
169
+ const packet = new THREE.Mesh(geo, mat);
170
+ packet.position.copy(startPos);
171
+ scene.add(packet);
172
+
173
+ // Add to animation array
174
+ particles.push({
175
+ mesh: packet,
176
+ progress: 0,
177
+ path: [
178
+ startPos,
179
+ new THREE.Vector3(-3, 0, 0), // Entry to pipe
180
+ new THREE.Vector3(3, 0, 0), // Exit pipe
181
+ destination
182
+ ]
183
+ });
184
+ };
185
+
186
+ function updateParticles() {
187
+ for (let i = particles.length - 1; i >= 0; i--) {
188
+ const p = particles[i];
189
+ p.progress += 0.015; // Speed
190
+
191
+ if (p.progress >= 3) {
192
+ // Reached end
193
+ scene.remove(p.mesh);
194
+ particles.splice(i, 1);
195
+ // Add a visual "pulse" to the destination (simple scale effect)
196
+ // (Omitted for brevity, but this is where you'd trigger a success effect)
197
+ continue;
198
+ }
199
+
200
+ // Determine which segment of the path we are on
201
+ let segmentIndex = Math.floor(p.progress);
202
+ let segmentProgress = p.progress - segmentIndex;
203
+
204
+ if (segmentIndex < 3) {
205
+ const start = p.path[segmentIndex];
206
+ const end = p.path[segmentIndex + 1];
207
+ p.mesh.position.lerpVectors(start, end, segmentProgress);
208
+ }
209
+ }
210
+ }
211
+
212
+ function updateLabels() {
213
+ const labels = document.querySelectorAll('.label');
214
+ labels.forEach(label => {
215
+ const pos = new THREE.Vector3(
216
+ parseFloat(label.dataset.x),
217
+ parseFloat(label.dataset.y),
218
+ parseFloat(label.dataset.z)
219
+ );
220
+ pos.project(camera);
221
+
222
+ const x = (pos.x * .5 + .5) * window.innerWidth;
223
+ const y = (pos.y * -.5 + .5) * window.innerHeight;
224
+
225
+ label.style.transform = `translate(-50%, -50%) translate(${x}px, ${y}px)`;
226
+ });
227
+ }
228
+
229
+ function animate() {
230
+ requestAnimationFrame(animate);
231
+
232
+ // Rotate pipeline slowly for visual effect
233
+ pipeline.rotation.x += 0.01;
234
+
235
+ updateParticles();
236
+ updateLabels();
237
+ renderer.render(scene, camera);
238
+ }
239
+
240
+ // Handle Resize
241
+ window.addEventListener('resize', () => {
242
+ camera.aspect = window.innerWidth / window.innerHeight;
243
+ camera.updateProjectionMatrix();
244
+ renderer.setSize(window.innerWidth, window.innerHeight);
245
+ });
246
+
247
+ animate();
248
+ </script>
249
+ </body>
250
+ </html>