Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
project_toon_cse457
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Shiven Bhatt
project_toon_cse457
Commits
7cea45bd
Commit
7cea45bd
authored
2 years ago
by
Shiven Bhatt
Browse files
Options
Downloads
Patches
Plain Diff
got slides working
parent
4c6893d2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
video.py
+20
-14
20 additions, 14 deletions
video.py
with
20 additions
and
14 deletions
video.py
+
20
−
14
View file @
7cea45bd
from
time
import
gmtime
from
cv2
import
rectangle
from
manim
import
*
from
manim
import
*
from
numpy
import
tri
SCREEN_WIDTH
=
14.2
SCREEN_WIDTH
=
14.2
SCREEN_HEIGHT
=
8
SCREEN_HEIGHT
=
8
class
Slide
:
def
__init__
(
self
,
objects
,
durations
):
self
.
objects
=
objects
self
.
durations
=
durations
class
Slide1
(
Scene
):
class
Slide1
(
Scene
):
def
construct
(
self
):
def
construct
(
self
):
self
.
image_
slideshow
([
self
.
slideshow
([
([
"
giraffe.jpg
"
]
,
3
),
Slide
([
self
.
get_image_group
([
"
giraffe.jpg
"
]
)],
[
3
]
),
([
"
giraffe.jpg
"
,
"
giraffe2.jpg
"
,
"
giraffe.jpg
"
],
3
),
Slide
([
self
.
get_image_group
([
"
giraffe.jpg
"
,
"
giraffe.jpg
"
,
"
giraffe2.jpg
"
])],
[
3
]
),
])
])
def
image_
slideshow
(
self
,
slides
):
def
slideshow
(
self
,
slides
):
for
slide
in
slides
:
for
slide
in
slides
:
images
,
duration
=
slide
for
i
in
range
(
0
,
len
(
slide
.
objects
)):
group
=
self
.
get_image_group
(
images
)
self
.
play
(
FadeIn
(
slide
.
objects
[
i
])
)
self
.
play
(
FadeIn
(
group
)
)
self
.
wait
(
slide
.
durations
[
i
]
)
self
.
wait
(
duration
)
self
.
play
(
FadeOut
(
group
))
self
.
play
(
FadeOut
(
*
slide
.
objects
))
def
get_image_group
(
self
,
images
):
def
get_image_group
(
self
,
images
):
image_width
=
SCREEN_WIDTH
/
(
len
(
images
))
image_width
=
SCREEN_WIDTH
/
(
len
(
images
))
...
@@ -57,7 +59,6 @@ class HappySphere(Scene):
...
@@ -57,7 +59,6 @@ class HappySphere(Scene):
self
.
wait
(
3
)
self
.
wait
(
3
)
self
.
play
(
FadeOut
(
im
,
text
))
self
.
play
(
FadeOut
(
im
,
text
))
class
RasterizationTriangleScene
(
ThreeDScene
):
class
RasterizationTriangleScene
(
ThreeDScene
):
def
construct
(
self
):
def
construct
(
self
):
self
.
set_camera_orientation
(
phi
=
PI
/
4
,
theta
=
PI
/
6
,
gamma
=
PI
/
2
)
self
.
set_camera_orientation
(
phi
=
PI
/
4
,
theta
=
PI
/
6
,
gamma
=
PI
/
2
)
...
@@ -69,6 +70,8 @@ class RasterizationTriangleScene(ThreeDScene):
...
@@ -69,6 +70,8 @@ class RasterizationTriangleScene(ThreeDScene):
self
.
add
(
cube
)
self
.
add
(
cube
)
self
.
wait
(
1
)
self
.
wait
(
1
)
Line3D
(
start
=
[],
end
=
[])
triangle
=
Polygon
([
0
,
0
,
0
],
[
0
,
1
,
0
],
[
1
,
0
,
0
],
stroke_width
=
1
,
stroke_color
=
RED
)
triangle
=
Polygon
([
0
,
0
,
0
],
[
0
,
1
,
0
],
[
1
,
0
,
0
],
stroke_width
=
1
,
stroke_color
=
RED
)
triangle
.
shift
([
-
0.5
,
-
0.5
,
2.5
])
triangle
.
shift
([
-
0.5
,
-
0.5
,
2.5
])
self
.
play
(
Create
(
triangle
))
self
.
play
(
Create
(
triangle
))
...
@@ -77,4 +80,7 @@ class RasterizationTriangleScene(ThreeDScene):
...
@@ -77,4 +80,7 @@ class RasterizationTriangleScene(ThreeDScene):
self
.
play
(
Transform
(
triangle
,
plane_triangle
))
self
.
play
(
Transform
(
triangle
,
plane_triangle
))
self
.
wait
(
1
)
self
.
wait
(
1
)
self
.
move_camera
(
phi
=
PI
,
theta
=
0
,
gamma
=
PI
/
2
)
self
.
move_camera
(
phi
=
PI
,
theta
=
0
,
gamma
=
PI
/
2
)
self
.
wait
(
1
)
self
.
wait
(
1
)
\ No newline at end of file
class
RaytracingScene
(
Scene
):
pass
\ No newline at end of file
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