Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Text to add
s = "BRAINRENDER"
# Specify a color for each letter
colors = makePalette(len(s), "salmon", "powderblue")
x = 0 # use to specify the position of each letter
# Add letters one at the time to color them individually
for n, letter in enumerate("BRAINRENDER"):
if "I" == letter or "N" == letter and n < 5: # make the spacing right
x += 0.6
else:
x += 1
# Add letter and silhouette to the scne
act = Text(
letter, depth=0.5, c=colors[n], pos=(x, 0, 0), justify="centered"
)
sil = act.silhouette().lw(3).color("k")
scene.add_actor(act, sil)
scene.render(interactive=False)
scene.close()
# Specify a color for each letter
colors = makePalette(len(s), "salmon", "powderblue")
x = 0 # use to specify the position of each letter
# Add letters one at the time to color them individually
for n, letter in enumerate("BRAINRENDER"):
if "I" == letter or "N" == letter and n < 5: # make the spacing right
x += 0.6
else:
x += 1
# Add letter and silhouette to the scene
print(colors[n])
act = Text(
letter,
depth=0.5,
c=colors[n],
pos=(x, 0, 0),
justify="centered",
alpha=1,
)
scene.add_silhouette(act, lw=3)
scene.render()
elif isinstance(color, (list, tuple)):
color = color[n]
# Get mesh's highest point
points = actor.points().copy()
point = points[np.argmin(points[:, 1]), :]
point += np.array(offset) + default_offset
try:
if atlas.hemisphere_from_coords(point, as_string=True) == "left":
point = atlas.mirror_point_across_hemispheres(point)
except IndexError:
pass
# Create label
txt = Text(label, point, s=size, c=color)
new_actors.append(txt)
# Mark a point on Mesh that corresponds to the label location
if radius is not None:
pt = actor.closestPoint(point)
new_actors.append(Sphere(pt, r=radius, c=color))
return new_actors