figureone
    Preparing search index...

    Function rectangleCloudShapes

    • Generate random points within a rectangle.

      Parameters

      Returns number[]

      array of interlaced x and y coordinates of vertices

      const { rectangleCloudShapes } = Fig.morph;

      const cloud1 = rectangleCloudShapes({
      num: 1000,
      width: 0.5,
      height: 0.5,
      position: [-0.5, 0],
      });

      const cloud2 = rectangleCloudShapes({
      num: 1000,
      width: 0.7,
      height: 0.7,
      });

      const m = figure.add({
      make: 'morph',
      points: [cloud1, cloud2],
      color: [1, 0, 0, 1],
      });

      m.animations.new()
      .morph({ start: 0, target: 1, duration: 2 })
      .start();