Changing Canvas Background Color Hue

921 views
Skip to first unread message

Cookie68

unread,
May 19, 2015, 1:43:52 PM5/19/15
to pap...@googlegroups.com
Dear paperJS fans,

I understand I can set the canvas background color via
var canvasLayer = document.getElementById("myCanvas");
    canvasLayer
.style.background = "black";

But Since I wanted to change the hue of this element over time I put this into my OnFrame function
//change hue slowly
canvasLayer
.style.background.hue += 1;    

But it seems paperJS can't access the hue like that (via background). But using fillColor(); won't color the canvas (which should work with .hue in the end).

Does someone have an idea, or do you want the full code? :o

Thanks and kind regards,
Cookie

Cookie68

unread,
May 19, 2015, 1:54:51 PM5/19/15
to pap...@googlegroups.com
Got it by myself this time, haha :D

Just create a Path.Rectangle and size it to the full width and height. Then change its fillColor.hue :)

Jürg Lehni

unread,
May 20, 2015, 5:20:25 PM5/20/15
to pap...@googlegroups.com
var background = new Shape.Rectangle({
    rectangle: view.bounds,
    fillColor: { hue: 180, saturation: 1, brightness: 1 }
});

On May 19, 2015, at 15:54 , Cookie68 <seriou...@freenet.de> wrote:

Got it by myself this time, haha :D

Just create a Path.Rectangle and size it to the full width and height. Then change its fillColor.hue :)

--
You received this message because you are subscribed to the Google Groups "Paper.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to paperjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages