embl_logo.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. """Create an animated logo"""
  2. from vedo import *
  3. from vedo.pyplot import histogram
  4. settings.use_parallel_projection = True
  5. exa = Polygon().scale(4.1).pos(5.25, 4.8, 0).off()
  6. his = histogram([-1, 1], [-1, 1], mode='hex').unpack()
  7. exah, cmh = [], []
  8. for h in his:
  9. cm = h.center_of_mass()
  10. if exa.is_inside(cm):
  11. h.c('green').shrink(0.9).add_shadow(plane='z', point=-.4)
  12. exah.append(h)
  13. cmh.append(cm)
  14. v1 = vector(9.4, 5.2, 0)
  15. v2 = vector(9.4, 2.7, 0)
  16. t1 = Text3D("EMBL", v1, c="k", font="VTK", s=1.5, depth=0)
  17. t2 = Text3D("European Molecular\nBiology Laboratory", v2, font="VTK", vspacing=1.75, c="dg", s=0.6)
  18. plt = show(exa, exah, t1, t2, axes=0, interactive=0, elevation=-50)
  19. for ti in reversed(range(100)):
  20. t = ti / 100.
  21. for j, h in enumerate(exah):
  22. cx, cy, _ = cmh[j] - [4,5,0]
  23. x = t*-4+(1-t)*6
  24. g = exp(-(cx-x)**2/.5)*2
  25. h.z(g)
  26. t1.pos([sin(t)*-10, 0, -0.41] + v1).alpha((1-t)**2)
  27. t2.pos([sin(t)*-15, 0, -0.41] + v2).alpha((1-t)**4)
  28. exah[13].c('red')
  29. plt.show(exa, exah, t1, t2, resetcam=0, elevation=t, azimuth=-0.02)
  30. plt.interactive()