Snapblocks (Part 2)

Continuing the discussion from Snapblocks (Part 1) - #252 by sonic123cdmania.

Previous discussions:

Well, there's nothing I can do to help with that.

:-(. Sad

unless they decied to add it to forums sorry man

I just upgraded define blocks to make them easier to make.

{test {test} $turtle (wow) [cool] <nice> ((cool)) :: motion} :: define+

test ({} @addInput) @turtle () [] <> ()

snapblocks

Yeah, you can now use $ instead of @ for icons (both act the same, although I am thinking of allowing the $text-size-r-g-b to work for text with a $).

But, the icon list might be an oversight. There is a plain list icon, but also a list input.

I did not think about that, but I can add that in.

You guys asked for it, I added the ability to set block colors (and input colors) using rgb values instead of a hex code.

(color [rgb(0 , 255 , 255)] :: rgb(0,255,0))

snapblocks (2)

This really stemmed from me using the Color class from snap (more specifically morphic.js) in snapblocks, which has a function to get a color from an rgb() string (well, it was rgba(), but I modified it to allow rgb(). Should I see if jens wants that in morphic.js?).

edit: oops, somehow I broke something
edit2: now it's fixed

Alright guys, I feel like I'm getting close to the last thing I'm adding this release. Here's what I've currently added.

  • Boolean switches.

    • <t> <f> <true> <false>
      snapblocks (7)
  • Snap define blocks automatically replace different shaped inputs with upvars

    • {[string] (number) <boolean>} :: define+
      snapblocks (4)
  • Actually correct comments

    • snapblocks (5)
  • Set color using rgb values

    • (color [rgb(0 , 255 , 255)] :: rgb(0,255,0))
      snapblocks (8)
  • Add icons using $

    • $turtle
      snapblocks (9)

I do want to add the ability to change text color using $text-s-r-g-b before I release 1.4.0 though.

edit: I've got that working for the snap style, not the scratch styles yet.

Keep in mind, I have not released all this yet, I'm just putting all of this here so you guys can see what I've done. Plus, there's a lot more stuff that changed behind the scenes anyway.


Update:
I've finished refactoring the snap style line positioning code, this time pretty much just copy / pasting from the snap source code, so hopefully the snap style is even more accurate.

I also managed to allow you to change the scale and color of text, by using the same syntax that snap uses, $text-s-r-g-b, although it's currently only in the snap style.

1.4.0 got released.

No more than 2 consecutive posts

I have released Snapblocks 1.4.0.

New Features:

  • Boolean switches. You can now do <t>, <f> (small true and false boolean inputs), and <true> and <false> (for big (static) boolean inputs).
  • Scale and recolor text using the same syntax as Snap!, $text-s-r-g-b e.g. $text-2-0-255-0.
  • Icons can beused with $ instead of just @. This was added to make it even more similar to Snap! (also so it's easier to convert Snap! labels to snapblocks).
    • Scaling and recoloring text can only be done with $, not @, @ is reserved for icons.
  • Easier input creation in custom block prototypes.
    • You can use {[string] (number) <boolean>} :: define+ to automatically get the correct upvar labels.
  • If there is @loop or @loopArrow at the end of a line right after a c-slot, that will be placed on the right side of the block, making that c-slot have a loop arrow.
  • Colors can be set using rgb values instead of just a hex color code, using this syntax rgb(r,g,b), for example, (color [rgb(0 , 255 , 255)] :: rgb(0,255,0)).
  • Allow for backslash in color input (to be text, rather than a color input), <touching color [\#fff] ?>.
  • Add @cloudGradient, @robot.
  • You can use either list or lists for the lists category.

Changes:

  • Refactored the Snap! style line rendering, to make it more like the Snap! source code (in fact, I just copy / pasted / edited from the Snap! source code).
  • New color system, which calculates the colors in the code, which means that zebra coloring uses the exact same colors as Snap!.
  • Remade the Snap! turnRight and turnLeft icons.
  • If a scale for an icon is set, the size will be 10 instead of 12.
  • @circle is no longer the same as @circleSolid, it's now a circle outline, like in Snap!.
  • @flag is now not colored, whereas @greenFlag is (I also added @greenflag because snap 10 uses that).
  • @loop is the full size loop, and @loopArrow is the scaled loop (again, from snap 10).
  • @turtle is now scaled by 1.2.
  • Probably more that I'm forgetting.

Fixes

  • Fixed the Snap! drop-shadow scaling on scaled icons.
  • General improvements to the Snap! style.
  • Fixed the Scratch 3 min hat width.
  • Fixed the line after the extension icon in the Scratch 3 style not showing up.
  • Fixed some blocks that were improperly detected.
  • Snap! custom blocks check for shape as as well as spec.
  • Upvars are formatted correctly.
  • Zebra coloring on upvars has been fixed (I didn't realize it was a problem before).
  • And many more fixes.

yummy

[scratchblocks]
define {{test {test :: custom-arg} :: motion}

The forum doesn't have snapblocks, so you'll have to test it out on https://snap-blocks.github.io/. Sorry.