I have the following code:
import plotly.graph_objs as go
hh=3
ww=5
xx0=0
yy0=0
zz0=0
xx1=[xx0, xx0, xx0+ww, xx0+ww, xx0, xx0, xx0+ww, xx0+ww]
yy1=[yy0, yy0+ww, yy0+ww, yy0, yy0, yy0+ww, yy0+ww, yy0]
zz1=[zz0, zz0, zz0, zz0, zz0+hh, zz0+hh, zz0+hh, zz0+hh]
fr0a = go.Mesh3d(x=xx1, y=yy1, z=zz1, flatshading=True, color='red', i = [0,0], j = [1,3], k = [2,2])
fr0b = go.Mesh3d(x=xx1, y=yy1, z=zz1, flatshading=True, color='yellow', i = [3,3], j = [7,2], k = [6,6])
fr0c = go.Mesh3d(x=xx1, y=yy1, z=zz1, flatshading=True, color='green', i = [0,0], j = [3,4], k = [7,7])
fr0d = go.Mesh3d(x=xx1, y=yy1, z=zz1, flatshading=True, color='cyan', i = [2,2], j = [6,1], k = [5,5])
fr0e = go.Mesh3d(x=xx1, y=yy1, z=zz1, flatshading=True, color='gray', i = [4,4], j = [1,2], k = [2,3])
fr1 = go.Frame(data=fr0a)
fr2 = go.Frame(data=[fr0b,fr0a])
fr3 = go.Frame(data=[fr0c,fr0b,fr0a])
fr4 = go.Frame(data=[fr0d,fr0c,fr0b])
fr5 = go.Frame(data=[fr0e,fr0d,fr0c])
axis0 = dict(showbackground=False,showticklabels=False,title='')
fig = go.Figure(
data=[fr0a],
layout=go.Layout(
showlegend=False,
scene=dict(aspectmode='data',xaxis=axis0,yaxis=axis0,zaxis=axis0),
title="the animation",
updatemenus=[dict(
type="buttons",
buttons=[dict(label="Play",
method="animate",
args=[None,dict(frame=dict(duration=1000,redraw=True),fromcurrent=False)])
])]
),
frames=[fr1,fr2,fr3,fr4,fr5]
)
fig.write_html("theanim.html",full_html=False, include_plotlyjs='cdn')
but I canβt display the other faces with different colors in the frame list. Itβs just limited to the first face in the list.