Coder Social home page Coder Social logo

Comments (18)

MoOx avatar MoOx commented on June 10, 2024

I'm guessing clone() method is not working properly.

from color.

ZuBB avatar ZuBB commented on June 10, 2024

Just a question of interest: Are you aware if usage of .clone() give some performance over Color()?

from color.

MoOx avatar MoOx commented on June 10, 2024

clone() use Color() :)

from color.

MoOx avatar MoOx commented on June 10, 2024

Btw, that's probably why it's buggy.

from color.

ZuBB avatar ZuBB commented on June 10, 2024

OK, thanks for reply..

from color.

iamstarkov avatar iamstarkov commented on June 10, 2024

@ZuBB can you create pull-request with failing tests?

from color.

ZuBB avatar ZuBB commented on June 10, 2024

Hi Vladimir!

I am very busy right now with my own stuff. If this can wait for a couple
of weeks then I will try to do it. Otherwise please assign this to other
person
On Jun 17, 2015 06:06, "Vladimir Starkov" [email protected] wrote:

@ZuBB https://github.com/ZuBB can you create pull-request with failing
tests?


Reply to this email directly or view it on GitHub
#46 (comment).

from color.

iamstarkov avatar iamstarkov commented on June 10, 2024

okie

from color.

iamstarkov avatar iamstarkov commented on June 10, 2024

@ZuBB please, check 0.9 release. I fixed incorrect implementation

from color.

MoOx avatar MoOx commented on June 10, 2024

Closing for now, feel free to reopen if you still have issues.

from color.

ZuBB avatar ZuBB commented on June 10, 2024

I made a hacked build (due to other reasons) with new 'mix' method only and things become event worse

2015-06-22-225226_1920x1080_scrot

I did small investigation and found that mix method started to fail case that used to pass. see #61

from color.

ZuBB avatar ZuBB commented on June 10, 2024

@MoOx do you reopen this?

from color.

Qix- avatar Qix- commented on June 10, 2024

Hi @ZuBB, could you provide a few tests showing the break? If you provide them here I can clean them up and put them in myself.

from color.

wmira avatar wmira commented on June 10, 2024

I think the immutability PR fixes this. I used the test below. @ZuBB please advise if my test case is wrong. The test below fails on previous version.

describe('mixing bug works with immutable', function () {
    it('mix produces proper color with clone or constructor or instance', function () {
        var baseColor = Color('#73FF73');
        var gtColor = Color('#FF7400');
        var ltColor = Color('#004DFF');

        [1, 2, 1.3, 1.4, 2.5, 4, 0.7, 8, 1.3].forEach(function (value) {
            var otherColor = value > 1 ? gtColor : ltColor;
            var weight = (value > 1 ? (value - 1) : (1 - value)) * 3;
            var resultColor1 = baseColor.clone().mix(otherColor, weight);
            var resultColor2 = Color('#73FF73').mix(otherColor, weight);
            var resultColor3 = baseColor.mix(otherColor, weight);
            deepEqual(resultColor1, resultColor2);
            deepEqual(resultColor2, resultColor1);
            deepEqual(resultColor1, resultColor3);
            deepEqual(resultColor3, resultColor1);
            deepEqual(resultColor2, resultColor3);
            deepEqual(resultColor3, resultColor2);
        });
    });
});

from color.

ZuBB avatar ZuBB commented on June 10, 2024

Hi @wmira!

I do not have a chance to test/run your code but for me it looks it have to cover buggy case.

from color.

stevemao avatar stevemao commented on June 10, 2024

I'm having trouble with the mix() function here
https://github.com/stevemao/color-transitions/blob/master/index.js#L38-L39

const color = color1.clone();
color.mix(color2, percent);

assume color1 is 'blue' and color2 is 'red', percent is 0.3
I was expecting it's 70% blue and 30% red, but it doesn't look like so.

from color.

Qix- avatar Qix- commented on June 10, 2024

Hey everyone. The cloning problem has been addressed in the rewrite (there is no .clone() method anymore - you'll just pass another color). Hopefully this fixes all of these problems. 💃

Any new issues should be opened as a new bug since it pertains to the rewrite.

from color.

Qix- avatar Qix- commented on June 10, 2024

Closing this since I believe this is fixed. Please let me know if that's not the case!

from color.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.