Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TU-Delft
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2024 Competition
TU-Delft
Commits
9e8d7c07
Commit
9e8d7c07
authored
6 months ago
by
Shraddha Raghuram
Browse files
Options
Downloads
Patches
Plain Diff
timeline
parent
6112411e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wiki/pages/home.html
+59
-0
59 additions, 0 deletions
wiki/pages/home.html
with
59 additions
and
0 deletions
wiki/pages/home.html
+
59
−
0
View file @
9e8d7c07
...
...
@@ -177,6 +177,65 @@
</div>
</div>
<canvas
id=
"timeline"
></canvas>
<script>
function
drawTimeline
()
{
const
canvas
=
document
.
getElementById
(
'
timeline
'
);
if
(
!
canvas
.
getContext
)
return
;
const
ctx
=
canvas
.
getContext
(
'
2d
'
);
// Clear the canvas before each redraw
ctx
.
clearRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
// Get the current scroll position
const
scrollY
=
window
.
scrollY
||
window
.
pageYOffset
;
// Get the canvas position relative to the viewport
const
canvasRect
=
canvas
.
getBoundingClientRect
();
// Calculate the starting point of the canvas relative to the document
const
canvasTop
=
scrollY
+
canvasRect
.
top
;
// Determine the scroll progress relative to the canvas
const
viewportHeight
=
window
.
innerHeight
;
const
scrollProgress
=
(
scrollY
+
viewportHeight
-
canvasTop
)
/
(
canvas
.
height
+
viewportHeight
);
// Clamp progress between 0 and 1
const
progress
=
Math
.
max
(
0
,
Math
.
min
(
scrollProgress
,
1
));
// Drawing parameters
ctx
.
strokeStyle
=
'
#185A4F
'
;
ctx
.
lineWidth
=
17
;
ctx
.
lineCap
=
'
round
'
;
ctx
.
lineJoin
=
'
round
'
;
// Begin drawing
ctx
.
beginPath
();
// Define your path here (customize as needed)
const
startX
=
canvas
.
width
/
2
;
const
startY
=
0
;
const
endY
=
canvas
.
height
;
// Calculate the current drawing point based on progress
const
currentY
=
startY
+
(
endY
-
startY
)
*
progress
;
// Move to the start point
ctx
.
moveTo
(
startX
,
startY
);
// Draw line to the current point
ctx
.
lineTo
(
startX
,
currentY
);
// Stroke the path
ctx
.
stroke
();
}
// Initial draw
drawTimeline
();
// Add scroll event listener
window
.
addEventListener
(
'
scroll
'
,
drawTimeline
);
</script>
<!--
<div class="homepage-content-img8 homepage-elements reveal" id="homepage-content-img8"></div>
<div class="homepage-content-img9 homepage-elements reveal" id="homepage-content-img9"></div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment