I want to erase whatever parts of the pen trail I am touching, but I can’t find a way to do that; rather, it seems that I can clear every pen trail on the stage or just leave them up.
You can set the pen color equal to the background color. When I do this I like to set the pen size to 3 just to make sure no stray pixels escape, but if your pentrails are crowded you might not want to do that.
I think the default pen size should be two imho because anything under it is translucent for some reason
Only if the background is one single colour (rather than a picture or gradient).
True… but there should be like a block like
when pen touching pen [erase v]::pen hat // erase pen lines instead of drawing over them when pen touching pen [draw over v]::pen hat // normal behavior
Edit with JBlueBird’s Snapblocks Pro
or maybe
if <touching pen?> {
[erase v] pen::pen cap // erase pen lines instead of drawing over them
} else {
[draw over v] pen::pen cap // normal behavior
}Edit with JBlueBird’s Snapblocks Pro
Anyway just something similar to this, to make it easier for beginner Snappers, or maybe I should implement this with Jcode…
What there should be, as in Logo, is a choice of three pen modes: PAINT, ERASE, and REVERSE. The third one XORs the pen color with the existing color at that point.
In Logo there are commands PENPAINT etc., but in Snap! we should just have a SET PEN MODE block with a menu.
This has been on my list from the very beginning of my involvement with BYOB and then Snap!, but I haven’t been able to get Jens excited about it.
I have not thought of a reverse function for that… that’s a pretty good idea!
So, if some of the other Snap! devs did follow through, any idea how this would work in the JS? Or would it just be some exported XML for a custom block?
set pen mode to [draw v]:: pen set pen mode to [erase v]:: pen set pen mode to [reverse v]:: pen //maybe it can be used like this perhaps in some projects? when pen touches pen::hat pen set pen mode to [erase v]:: pen move [10] steps
Edit with JBlueBird’s Snapblocks Pro
Maybe I can add these blocks to Jcode, then have some of my friends use these blocks in really awesome ways to convince Jens to add it to Snap!
You wouldn’t set the mode to erase at the moment of touching another pentrail point. Instead, you’d just set the mode to erase ahead of time, or if you want the pen to draw except when it’s touching another pentrail point, that’s what PEN REVERSE is for!
As for how it’s implemented, I’m pretty sure Canvas already provides this capability.
Say if Snappers want to implement this with custom blocks, how would they most likely implement the reverse function?
That seems a little tedious to do, especially with some Snappers not knowing JS
Yeah, it wouldn’t be easy, which is why we should make it a primitive.
So if I were to add this block into Jcode, how would I do that with the JS, and also effect the stage with the pen?
Is there some sort of docs I can read?
This is the Snap! Forum, not the Jcode Forum. Could you please take your off-topic messages (of which you make a lot) into another post? Maybe even start a blog or something?
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
