How to set fill opacity but leave stroke opacity unchanged?

173 views
Skip to first unread message

nardove

unread,
Nov 2, 2020, 5:31:19 PM11/2/20
to Paper.js
I want to know if it is at all possible to the the opacity independently for the fill and stroke, so say how can I set the fill opacity to 0.5 and the stroke opacity to 1.0

Thanks,
Ricardo 

Samuel ASENSI

unread,
Nov 3, 2020, 4:44:53 AM11/3/20
to pap...@googlegroups.com
Hi,

yes, this is easily doable by using the alpha property of the colors.
Here is a simple sketch demonstrating it.

new Path.Circle({
    center: view.center,
    radius: 50,
    fillColor: new Color(1, 0, 0, 0.5),
    strokeColor: new Color(1, 0, 0, 1),
    strokeWidth: 20
});

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/paperjs/dea40e9e-2216-4900-8f8c-8a7f1dcfda03n%40googlegroups.com.


--
    Samuel ASENSI
Reply all
Reply to author
Forward
0 new messages