## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup, eval = FALSE------------------------------------------------------ # library(plotly) # library(sync3d) # # # 1. Define spatial coordinates (e.g., a simple geometric diamond framework) # nodes_df <- data.frame( # x = c(0, 1, 0, -1, 0, 0), # y = c(0, 0, 1, 0, 0, 0), # z = c(1, 0, 0, 0, -1, 0) # ) # # # 2. Map the structural connections (from point index to point index) # edge_matrix = matrix(c(1,2, 1,3, 1,4, 1,6), ncol = 2, byrow = TRUE) # # # 3. Build the animated marker base # base_plot <- plot_ly(data = nodes_df, x = ~x, y = ~y, z = ~z, # type = 'scatter3d', mode = 'markers') # # # 4. Inject the WebGL engine # final_plot <- add_synchronized_3d_edges(base_plot, edge_matrix)