mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-17 13:41:10 +00:00
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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user