mirror of
https://github.com/SamEyeBam/animate.git
synced 2026-10-01 10:06:53 +00:00
rgb manipulation optimisation
This commit is contained in:
@@ -6,8 +6,8 @@ class FloralPhyllo extends BaseShape {
|
||||
{ type: 'range', min: 1, max: 600, defaultValue: 300, property: 'width' },
|
||||
{ type: 'range', min: 1, max: 300, defaultValue: 150, property: 'depth' },
|
||||
{ type: 'range', min: 0, max: 3141, defaultValue: 0, property: 'start' },
|
||||
{ type: 'color', defaultValue: '#4287f5', property: 'colour1' },
|
||||
{ type: 'color', defaultValue: '#FC0362', property: 'colour2' },
|
||||
{ type: 'color', defaultValue: [66, 135, 245], property: 'colour1' },
|
||||
{ type: 'color', defaultValue: [252, 3, 98], property: 'colour2' },
|
||||
];
|
||||
|
||||
constructor(width, depth, start, colour1, colour2) {
|
||||
@@ -26,7 +26,7 @@ class FloralPhyllo extends BaseShape {
|
||||
const c = 1;
|
||||
|
||||
for (let n = this.depth; n > 0; n -= 1) {
|
||||
const ncolour = LerpHex(this.colour1, this.colour2, n / this.depth);
|
||||
const ncolour = colourToText(lerpRGB(this.colour1, this.colour2, n / this.depth));
|
||||
const a = n * rotation / 1000;
|
||||
const r = c * Math.sqrt(n);
|
||||
const x = r * Math.cos(a) + centerX;
|
||||
|
||||
Reference in New Issue
Block a user