Skip to content

Superformula

The cientos package provides a <Superformula /> component that produces a configurable 3D plot of the superformula.

Usage

vue
<script setup lang="ts">
import { OrbitControls, Superformula } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
</script>

<template>
  <TresCanvas clear-color="#777">
    <Superformula
      :num-arms-b="24"
      :exp-b="[40, 30, 20]"
    >
      <TresMeshNormalMaterial />
    </Superformula>
    <OrbitControls />
  </TresCanvas>
</template>

Props

The <Superformula /> 3D plot is the product of 2 2D superformulas, referred to as "A" and "B" in the props. See this Wikipedia article about the superformula for more information about the function's arguments.

NameDescriptionDefault
Number of horizontal mesh segments
32
Number of vertical mesh segments
32
For A, number of radial arms/ripples4
A's 3 exponents
[40, 1.3, 0.9]
For B, number of radial arms/ripples
4
B's 3 exponents
[40, 1.3, 0.9]
If no material is provided, a color for the default material
'white'

Slot

<Superformula /> has a single slot for an optional material.