Changing opacity with hv.Curve using the plotly backend

This seems like a simple question, but I can’t find an example. Is it possible to change the opacity of a line plot when using the Plotly backend?

ChatGPT gave me this example, but it doesn’t work.

# Generate time data
time = np.linspace(0, 10, 100)

# Calculate sine wave values
values = np.sin(time)

# Create a DataFrame
df = pd.DataFrame({
    'Time': time,
    'Sine Wave': values
})


# Define a hook to apply opacity and line width in Plotly
def apply_style(plot, element):
    plot.state.traces[0].update(line=dict(width=6, opacity=0.3))

# Create the curve using the hook for styling
sine_wave_plot = hv.Curve(df, 'Time', 'Sine Wave', label='Sine Wave').opts(hooks=[apply_style])

# Create Panel layout
layout = pn.Column("# Sine Wave Visualization", sine_wave_plot)

# Serve the Panel layout
layout.servable(title="Sine Wave Plot")