Skip to content

Transformations

Modifying the whole group

three-scatter extend from THREE.Group and you can apply affine transformation to the whole group.

js
import { ThreeScatter } from 'three-scatter'

const scatter = new ThreeScatter(count, surface, model);
scatter.scale.set(0.5,0.5,0.5);

Modifying individuals models

three-scatter provides setAll method that allow you affect all the scattered models.

js
import { ThreeScatter } from 'three-scatter'

const scatter = new ThreeScatter(count, surface, [model1, model2, model3]);

scatter.setAll((model, index) => {
  const random = Math.random()
  model.rotation.set(random, random, random);
});

Note: you can get creative and changing transformations or parameters in individuals scattered objects.

Modifying a specific models

js
import { ThreeScatter } from 'three-scatter'

const scatter = new ThreeScatter(count, surface, [model1, model2, model3]);

scatter.setAll((model, _) => {
  // Applying transformation to a specific object
  model[0].rotation.set(0.5, 0.5, 0.5);
});