D3 Freehand Drawing. Stroke selection palette for marker pen and architectural pen

57 views
Skip to first unread message

Alison De Backer

unread,
Jan 3, 2017, 5:51:25 PM1/3/17
to d3-js

No , I am not a coder but a heritage enthusiast that would like to introduce my students to freehand drawing - the old fashioned way.

Problem: Need two palettes

  • one for marker pen 0.2 opacity 13px wide
  • one for architectural pen 0.9 opacity 1 px wide

I have cobbled together a D3 Block using existing code

Can't make the code work. Please help Freehand Doodles

Vlado Z

unread,
Jan 4, 2017, 7:22:11 AM1/4/17
to d3-js
So your problem is the thickness and the opacity?

I think you can do that in the click listeners of your paint and pen buttons:

pen_btn = ui.append('text').html('').attr({
 
"class": 'btn',
  dy
: '0.35em',
  transform
: 'translate(940,80)'
}).on('click', function() {
    drawing_data
.lines = [];

    active_opacity = "0.9";
    active_weight
= "1px";
   
return redraw();
 
});
 
   paint_btn
= ui.append('text').html('').attr({
 
"class": 'btn',
  dy
: '0.35em',
  transform
: 'translate(940,140)'
}).on('click', function() {
    drawing_data
.lines = [];  

    active_opacity = "0.2";
    active_weight
= "13px";
    return redraw();
 
});


Alison De Backer

unread,
Jan 4, 2017, 9:18:52 PM1/4/17
to d3-js
Thanks Vlado.

I Kind of get the concept but I tried it in a JS Fiddle without success. 

I know what it is meant to do but not sure what code needs to be where. If you have a complete  JS Fiddle or Block I can fork I can copy with that would be great.

Cheers A

Vlado Z

unread,
Jan 12, 2017, 4:17:18 AM1/12/17
to d3-js
Do yo still need work? I could possibly provide you with solution, but I am gonna have to charge something for the work if necessary.
Do you use Moneybookers(Skrill)?
Reply all
Reply to author
Forward
0 new messages