Move ui-identicon -> react-identicon (#165)

* Move ui-identicon -> react-identicon

* ui-identicon import fix

* Update README package links

* Update doc sidebar links

* Adjust react-qr signatures, CHANGELOG
This commit is contained in:
Jaco Greeff
2019-07-29 11:30:37 +02:00
committed by GitHub
parent faf234fedc
commit c3f57c19e8
50 changed files with 56 additions and 52 deletions
@@ -0,0 +1,23 @@
// Copyright 2016 Dan Finlay
// Copyright 2017-2019 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Seeder } from '../types';
import newCircle from '../svg/circle';
import { SHAPE_COUNT } from '../defaults';
export default function circle (seeder: Seeder, fill: string, diameter: number, count: number): Element {
const center = diameter / 2;
const angle = seeder() * 360;
const radius = (((SHAPE_COUNT - count) / SHAPE_COUNT) * (diameter / 2)) + ((diameter / 8) * seeder());
const offset = (diameter / 4) * (seeder() + ((count + 1) / SHAPE_COUNT));
const cx = (offset * Math.sin(angle)) + center;
const cy = (offset * Math.cos(angle)) + center;
const svg = newCircle(radius, cx, cy);
svg.setAttributeNS('', 'fill', fill);
return svg;
}