mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
reorganized files in EoP
This commit is contained in:
26
active_projects/eop/reusables/dice.py
Normal file
26
active_projects/eop/reusables/dice.py
Normal file
@ -0,0 +1,26 @@
|
||||
from mobject.svg.svg_mobject import *
|
||||
|
||||
class DieFace(SVGMobject):
|
||||
|
||||
def __init__(self, value, **kwargs):
|
||||
|
||||
self.value = value
|
||||
self.file_name = "Dice-" + str(value)
|
||||
self.ensure_valid_file()
|
||||
SVGMobject.__init__(self, file_name = self.file_name)
|
||||
|
||||
class RowOfDice(VGroup):
|
||||
CONFIG = {
|
||||
"values" : range(1,7),
|
||||
"direction": RIGHT,
|
||||
}
|
||||
|
||||
def generate_points(self):
|
||||
for value in self.values:
|
||||
new_die = DieFace(value)
|
||||
new_die.submobjects[0].set_fill(opacity = 0)
|
||||
new_die.submobjects[0].set_stroke(width = 7)
|
||||
new_die.next_to(self, self.direction)
|
||||
self.add(new_die)
|
||||
self.move_to(ORIGIN)
|
||||
|
Reference in New Issue
Block a user