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
widthSegmentsNumber of horizontal mesh segments
32
heightSegmentsNumber of vertical mesh segments
32
numArmsAFor A, number of radial arms/ripples4
expAA's 3 exponents
[40, 1.3, 0.9]
numArmsBFor B, number of radial arms/ripples
4
expBB's 3 exponents
[40, 1.3, 0.9]
colorIf no material is provided, a color for the default material
'white'

Slot

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