Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bielefeld-CeBiTec
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
Bielefeld-CeBiTec
Commits
df25d7ff
Commit
df25d7ff
authored
5 months ago
by
Asal Sahami Moghaddam
Browse files
Options
Downloads
Patches
Plain Diff
fanzor
parent
e24ebc43
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Fanzorviewer.tsx
+27
-9
27 additions, 9 deletions
src/components/Fanzorviewer.tsx
src/contents/engineering.tsx
+1
-1
1 addition, 1 deletion
src/contents/engineering.tsx
with
28 additions
and
10 deletions
src/components/Fanzorviewer.tsx
+
27
−
9
View file @
df25d7ff
...
...
@@ -2,21 +2,27 @@ import React, { useEffect } from 'react';
import
*
as
THREE
from
'
three
'
;
export
const
ProteinViewer
:
React
.
FC
=
()
=>
{
const
viewerRef
=
useRef
<
HTMLDivElement
>
(
null
);
// Ref for the div container
useEffect
(()
=>
{
//Set up the scene, camera, and renderer
const
scene
=
new
THREE
.
Scene
();
const
camera
=
new
THREE
.
PerspectiveCamera
(
75
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
1000
);
const
camera
=
new
THREE
.
PerspectiveCamera
(
75
,
1
,
0.1
,
1000
);
// Adjust aspect ratio if needed
const
renderer
=
new
THREE
.
WebGLRenderer
({
antialias
:
true
});
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
document
.
body
.
appendChild
(
renderer
.
domElement
);
//Add lighting to the scene
renderer
.
setSize
(
200
,
200
);
// Append the renderer to the div container instead of body
if
(
viewerRef
.
current
)
{
viewerRef
.
current
.
appendChild
(
renderer
.
domElement
);
}
const
light
=
new
THREE
.
DirectionalLight
(
0xffffff
,
1
);
light
.
position
.
set
(
0
,
1
,
2
);
scene
.
add
(
light
);
camera
.
position
.
z
=
5
;
// Adjust the camera position
//Render loop
camera
.
position
.
z
=
5
;
// Render loop
const
animate
=
()
=>
{
requestAnimationFrame
(
animate
);
renderer
.
render
(
scene
,
camera
);
...
...
@@ -25,11 +31,23 @@ export const ProteinViewer: React.FC = () => {
// Clean up on component unmount
return
()
=>
{
document
.
body
.
removeChild
(
renderer
.
domElement
);
if
(
viewerRef
.
current
)
{
viewerRef
.
current
.
removeChild
(
renderer
.
domElement
);
}
};
},
[]);
return
null
;
// No JSX to return as we're appending the canvas directly to the body
return
(
<
div
ref
=
{
viewerRef
}
style
=
{
{
width
:
'
400px
'
,
// Customize the width
height
:
'
400px
'
,
// Customize the height
margin
:
'
0 auto
'
,
// Center it if you want
border
:
'
1px solid #ddd
'
,
// Optional: border around the viewer
}
}
/>
);
};
export
default
ProteinViewer
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/contents/engineering.tsx
+
1
−
1
View file @
df25d7ff
...
...
@@ -168,7 +168,7 @@ export function Engineering() {
<
div
className
=
"bg-lb box"
>
<
H3
id
=
"Nikase"
text
=
"Nikase"
></
H3
>
<
p
><
LoremShort
></
LoremShort
></
p
>
<
img
src
=
"https://static.igem.wiki/teams/5247/fanzor/movie
2
-ezgif-com-video-to-gif-converter.gif"
></
img
>
<
img
src
=
"https://static.igem.wiki/teams/5247/fanzor/movie
4
-ezgif-com-video-to-gif-converter.gif"
></
img
>
</
div
>
<
div
className
=
"box"
>
<
p
id
=
"nik1"
>
...
...
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