Synchronized 3D Vector and Marker Animations in 'Plotly'

Provides a domain-agnostic visualization utility designed to bypass structural rendering limitations within multi-trace three-dimensional animations in 'Plotly' by implementing a decoupled rendering pipeline. Computational processing of time-dependent physical states (markers and nodes) is managed within the R environment, while a custom hardware-accelerated 'WebGL' injection handles the synchronous rendering of complex topological frameworks (lines and edges) directly within the 'UI' browser interface via 'htmlwidgets'. This dual-layer architecture ensures smooth execution of synchronized multi-component 3D animations without framework degradation or controller loss.


# ==========================================================================
# ++ [ sync3d ] :  Quantum Geometric Alignment Engine
# --------------------------------------------------------------------------
# > Hardware-Accelerated Multi-Trace 3D Animations via WebGL Injections
# --------------------------------------------------------------------------
#                     Katharina Maria Brecht (2026)
#                      ORCID: 0009-0001-2176-7476
# ==========================================================================

sync3d | Quantum Geometric Alignment Engine

Synchronized 3D Vector and Marker Animations in 'plotly' via 'WebGL'

Author: Katharina Maria Brecht | ORCID: 0009-0001-2176-7476 | License: GPL-3

sync3d is a lightweight, high-performance R package that bypasses structural rendering bottlenecks in multi-trace 3D animations in plotly. By decoupling vertex computation from wireframe rendering, it enables smooth, hardware-accelerated 3D animations without UI degradation or camera controller resets.


Installation

Install the released version from CRAN:

install.packages("sync3d")
library(sync3d)

Dual-Layer Architecture

In native plotly, animating both nodes and edges simultaneously forces the CPU to rebuild the full geometric mesh on every frame, causing visible lag or UI freezes. sync3d resolves this through a dual-layer pipeline:

  1. Particle Layer (R / CPU): Computes frame-by-frame node coordinates (x, y, z) in R and passes them as Trace 0 to plotly::plot_ly().
  2. Metadata Bridge (customEdgeIndices): add_synchronized_3d_edges() serializes the $E \times 2$ vertex index matrix once (as.numeric(t(edge_indices))) into base_plot$x$customEdgeIndices.
  3. WebGL Wireframe Layer (Browser / GPU): An injected JavaScript hook via htmlwidgets::onRender() listens to the plotly_animated event and updates the topological line trace in real time via Plotly.restyle().

Quick Start: Animated 3D Regular Octahedron

library(plotly)
library(sync3d)

# 1. Canonical vertices of a regular 3D octahedron (V = 6)
base_vertices <- data.frame(
  x0 = c( 1, -1,  0,  0,  0,  0),
  y0 = c( 0,  0,  1, -1,  0,  0),
  z0 = c( 0,  0,  0,  0,  1, -1)
)

# 2. Generate T = 20 frames with harmonic radial oscillation
theta <- seq(0, 2 * pi, length.out = 20)
anim_df <- do.call(rbind, lapply(seq_along(theta), function(t_idx) {
  r_t <- 1 + 0.30 * sin(theta[t_idx])
  data.frame(
    frame = t_idx,
    x = base_vertices$x0 * r_t,
    y = base_vertices$y0 * r_t,
    z = base_vertices$z0 * r_t
  )
}))

# 3. Define the 12 structural edges of the octahedron (E = 12)
edge_indices <- matrix(c(
  1, 3,  1, 4,  1, 5,  1, 6,
  2, 3,  2, 4,  2, 5,  2, 6,
  3, 5,  3, 6,  4, 5,  4, 6
), ncol = 2, byrow = TRUE)

# 4. Build the animated 3D marker base and inject WebGL edge synchronization
base_plot <- plot_ly(
  data = anim_df,
  x = ~x, y = ~y, z = ~z,
  frame = ~frame,
  type = "scatter3d",
  mode = "markers",
  marker = list(size = 7, color = "#005F73")
)

final_plot <- add_synchronized_3d_edges(base_plot, edge_indices)
final_plot

Target Applications

  • Crystallography & Materials Science: Lattice defects, atomic displacement vectors, and structural phase transitions.
  • Structural Biology & Biochemistry: Dynamic protein folding pathways and macromolecular conformations.
  • Network Analysis & Graph Theory: Large-scale interactive 3D networks with time-varying cluster states.
  • Quantum Physics & Wave Mechanics: Time-evolving 3D wave interference fields, polyhedral resonance modes, and dynamic state transitions across discrete spatial lattices.

Intention & Scientific Context

sync3d was originally conceptualized during the development of octawave (Spatial Octahedral Quantum Wave Functions) to animate time-evolving 3D polyhedral wave interference models without breaking interactive camera controls.


Companion Ecosystem

sync3d forms the temporal animation layer within a four-package R ecosystem connecting 3D spatial wave physics to 2D boundary projections and discrete matrix quantization:

  • octawave – 3D octahedral & polyhedral quantum wave interference fields
  • sync3d – Decoupled WebGL engine for synchronized real-time 3D animations
  • theaitetos – Geometric projections from 3D wave volumes onto 2D boundary surfaces
  • KataLoom – Deterministic 16-color threshold-matrix dithering, cyclic index permutations & structured lattice visualization

License

This package is licensed under the GPL-3 License.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("sync3d")

0.1.2 by Katharina Maria Brecht, 5 days ago


https://github.com/KatharinaBrecht-Quantum/sync3d


Report a bug at https://github.com/KatharinaBrecht-Quantum/sync3d/issues


Browse source code at https://github.com/cran/sync3d


Authors: Katharina Maria Brecht [aut, cre] (ORCID:


Documentation:   PDF Manual  


GPL-3 license


Imports htmlwidgets, plotly

Suggests knitr, rmarkdown


Imported by octawave.


See at CRAN