Refraction

refraction

the script variables ir1 and ir2 are the indices of refraction of the left and right sides of the stage, respectively

it only draws when the mouse is right of the leftmost pixel (column) of the stage, to discount the uninteresting cases where the ray doesn't even intersect the material boundary

it also currently does not account for when total internal reflection would occur, instead attempting to set the y value to NaN, which ends up putting the rightmost point at y=0

Nice. In the color version, I had trouble seeing the blue line, so after several failed experiments with changing the bg color, I set the pen size to 3.

(Speaking of the bg color, why do you use a costume rather than just
untitled script pic (13)
? Or, if you're going to use a costume anyway, use two slightly different shades of gray for the two sides of the stage?)

it would be much faster if pen operations could be done with a lighten blend mode

Make a proposal for how we would present blend modes to users.

because pen trails doesn't always report a stage-sized costume, so i have to do a kludge -- either draw dummy pixels at two opposite corners of the stage, or paste the pen trails on an all-black stage. i happened to pick the latter

will do, once i'm done modifying a copy of my λlist project

i'd make these blocks and put them in a library
blend mode

And what would the blend mode affect? Drawing by moving? Stamping? Etc.

... Oh wait, it says "pen." So just drawing?

i'd say probably everything in


, though definitely at least drawing

do you have any ideas for block names given the above?

I'd just leave out "pen." :~)

Is there a more human-friendly way to describe "blend mode"? Or do you think our users already know what it means?

How about NEW PAINT [REPLACES | LIGHTENS | DARKENS | etc] OLD COLOR ?

yeah i was thinking that too

i honestly have no idea

that would probably work quite well, except no primitive calls it "paint", so i'd think that association wouldn't exist for a lot of people

"ink"?

the only thing the primitives call it is "pen" (and the ones that don't refer to the pen don't call it anything, except for PEN TRAILS (and PEN VECTORS, if you enable that), which calls it "pen" too)

The reason I keep banging on this point is that, in my mind, there is a distinction between a (real world) pen, a writing instrument, and the paint or ink that the pen deposits on the page. I suppose "trails" is what we've been calling the ink. In retrospect I wish we'd called the blocks SET INK COLOR etc. In Logo, the blending mode is called PENMODE, which can have three possible values: PAINT, ERASE, or REVERSE. REVERSE is xor, of course, and ERASE means to draw in the background color instead of the pen color.

But okay, fine, "pen" it is... but then my wording (NEW X [REPLACES...] OLD COLOR) doesn't work, if X=pen.

What modes do you think we should support? There are too many of them in Photoshop.

Paint.Net has this list, most of which i don't know
image
i'd definitely have at least normal (what Snap! currently does), xor, lighten, darken, and erase

Canvas API have built-in composition modes W3C

Thank you. Interesting that they don't have darken (which I guess would mean multiplying the colors as mapped into [0,1) ).

I'm a little confused by why the overlap area in the xor mode is black, rather than some flavor of purple. Does xor mean that any color at the same point in both shapes implies black? Or does it imply transparent and that picture just happens to have a black background? (I know, I could experiment. I'm lazy.)

Thanks.

Rather transparent.

:link: Another view with updated modes list :link:

Ah, great. So, as usual my proposal is to keep only the ones I understand, on the grounds that if I don't understand something, neither will the users.

untitled script pic (7)

Their name My name
source-over replaces
source-in bounded by
source-atop only where
destination-over behind
destination-in masks
destination-out deletes
xor xor
darken darkens
lighten lightens

That's nine modes, kind of a lot but they're all useful I guess. They have different flavors of lightening and darkening; arguably the + and × ones are more natural looking, but the ones I picked are easy to explain. :~) I'd prefer a better name than "xor" for that one; Logo uses PENREVERSE (the other options being PENPAINT and PENERASE) but "reverse" doesn't quite work with my infix menu, and "reverses," while grammatical, isn't really understandable.

This is all appallingly non-functional. Maybe there should also be a block
untitled script pic (8)
?

also of note is that the + lighten (lighter) is the one that i'd need for my project

what are the intended inputs to that?

Shapes, which in Snap! means costumes, I guess. One of which might be made from the pen trails.