Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
import * as d3Random from 'd3-random';
// ------------------------------------------------------------
// Preparatory Steps
// ------------------------------------------------------------
let randomNumberGenerator: () => number;
// ------------------------------------------------------------
// randomUniform
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomUniform();
randomNumberGenerator = d3Random.randomUniform(0.2);
randomNumberGenerator = d3Random.randomUniform(0.2, 5);
// ------------------------------------------------------------
// randomNormal
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomNormal();
randomNumberGenerator = d3Random.randomNormal(3);
randomNumberGenerator = d3Random.randomNormal(3, 4);
// ------------------------------------------------------------
// randomLogNormal
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomLogNormal();
import * as d3Random from 'd3-random';
// ------------------------------------------------------------
// Preparatory Steps
// ------------------------------------------------------------
let randomNumberGenerator: () => number;
// ------------------------------------------------------------
// randomUniform
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomUniform();
randomNumberGenerator = d3Random.randomUniform(0.2);
randomNumberGenerator = d3Random.randomUniform(0.2, 5);
// ------------------------------------------------------------
// randomNormal
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomNormal();
randomNumberGenerator = d3Random.randomNormal(3);
randomNumberGenerator = d3Random.randomNormal(3, 4);
// ------------------------------------------------------------
// randomLogNormal
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomLogNormal();
randomNumberGenerator = d3Random.randomLogNormal(3);
import * as d3Random from 'd3-random';
// ------------------------------------------------------------
// Preparatory Steps
// ------------------------------------------------------------
let randomNumberGenerator: () => number;
// ------------------------------------------------------------
// randomUniform
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomUniform();
randomNumberGenerator = d3Random.randomUniform(0.2);
randomNumberGenerator = d3Random.randomUniform(0.2, 5);
// ------------------------------------------------------------
// randomNormal
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomNormal();
randomNumberGenerator = d3Random.randomNormal(3);
randomNumberGenerator = d3Random.randomNormal(3, 4);
// ------------------------------------------------------------
// randomLogNormal
// ------------------------------------------------------------
randomNumberGenerator = d3Random.randomLogNormal();
randomNumberGenerator = d3Random.randomLogNormal(3);
randomNumberGenerator = d3Random.randomLogNormal(3, 4);
// Inspired by https://bl.ocks.org/mbostock/4060954
import React, { Component, PureComponent } from 'react'
import { Motion } from '../../../src'
import Demo from '../Demo'
import { scaleLinear } from 'd3-scale'
import { min, max } from 'd3-array'
import { randomUniform } from 'd3-random'
const WOBBLY_SPRING = { stiffness: 60, damping: 15 }
const radiusGenerator = randomUniform(2, 8)
function randomRadius () {
return radiusGenerator()
}
const width = 800
const height = 450
class Scatterplot extends PureComponent {
render () {
const { points } = this.props
const maxY = max(points, d => d[1])
const minY = min(points, d => d[1])
const maxX = max(points, d => d[0])
const xScale = scaleLinear().domain([0, maxX]).range([0, width])
const yScale = scaleLinear().domain([minY, maxY]).range([height, 0])
static randomLatitude() {
return d3r.randomUniform(-90, 90)();
} // randomLatitude
static intBetween(min, max) {
return Math.round(d3r.randomUniform(min, max)());
} // intBetween
static randomLongitude() {
return d3r.randomUniform(-180, 180)();
} // randomLongitude
() => {
return this.setState({ points: this.generateLayers(randomUniform(1, 500)() | 0) })
},
1000
getKey = (data, i) => i + '-' + (randomUniform(1, 2)() | 0);
export const uniformRandomizer = (amplitude: number) => (value: number) => {
return value + randomUniform(-amplitude / 2, amplitude / 2)();
};