All Projects → scratch4d → scratch-LN

scratch4d / scratch-LN

Licence: Apache-2.0 license
https://scratch4d.github.io/scratch-LN/

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Labels

Projects that are alternatives of or similar to scratch-LN

Robot blockly
A simple way to program ROS robots using blockly.
Stars: ✭ 115 (+505.26%)
Mutual labels:  scratch
cod4-docker
Runs a Call of duty 4 Modern Warfare (cod4x) dedicated server in a Docker container.
Stars: ✭ 44 (+131.58%)
Mutual labels:  scratch
Meower-Vanilla
Official source code for the Scratch-based Meower client.
Stars: ✭ 24 (+26.32%)
Mutual labels:  scratch
Pixie
Unofficial rewrite of Scratch in JavaScript.
Stars: ✭ 123 (+547.37%)
Mutual labels:  scratch
Phosphorus
JavaScript compiler for Scratch projects.
Stars: ✭ 250 (+1215.79%)
Mutual labels:  scratch
apostilas
Apostilas sobre diversos assuntos: PHP, PDO, MySQL, PHPOO, MVC, mobile, scratch, git, github, docker, vps, alpine linux, segurança na wev, servidores, etc
Stars: ✭ 49 (+157.89%)
Mutual labels:  scratch
Jxscratchview
一个万能的刮刮乐控件。无论是UILabel、UIImageView,还是自定义视图,只要是UIView都可以用来刮。代码简单,功能强大,你值得拥有!
Stars: ✭ 100 (+426.32%)
Mutual labels:  scratch
Lang-app
Add a multi lang configuration to your WEB APP 'from scratch' [ANY FRAMEWORK, ANY PLUGIN, ANY API]
Stars: ✭ 15 (-21.05%)
Mutual labels:  scratch
web-app-from-scratch
Supporting material for my blog post series on writing a web application from scratch in Python.
Stars: ✭ 128 (+573.68%)
Mutual labels:  scratch
Pyonkee
Pyonkee is a visual-programming environment for iPad. It is based on Scratch from the MIT Media Lab.
Stars: ✭ 80 (+321.05%)
Mutual labels:  scratch
Scratchaddons
All-in-one browser extension for Scratch.
Stars: ✭ 133 (+600%)
Mutual labels:  scratch
Blocklike
Bridging the gap between block programming and JavaScript.
Stars: ✭ 177 (+831.58%)
Mutual labels:  scratch
codes-scratch-zookeeper-netty
zk + netty 实现集群节点文件同步服务
Stars: ✭ 29 (+52.63%)
Mutual labels:  scratch
Codelab adapter extensions
codelab_adapter extensions
Stars: ✭ 120 (+531.58%)
Mutual labels:  scratch
Gratch
Block-style programming environment for tackling graph structure and graph algorithm, based on MIT Scratch.
Stars: ✭ 15 (-21.05%)
Mutual labels:  scratch
Snap4arduino
Binding Snap! and Arduino together
Stars: ✭ 107 (+463.16%)
Mutual labels:  scratch
s3onegpio
Scratch 3 Extensions For Arduino, Circuit Playground Express, ESP-8266, Picoboard and Raspberry Pi
Stars: ✭ 68 (+257.89%)
Mutual labels:  scratch
coro-scratch
A Scratch to Python transpiler that makes extensive use of coroutines
Stars: ✭ 22 (+15.79%)
Mutual labels:  scratch
LiteGui
Immediate Mode GUI From Scratch
Stars: ✭ 15 (-21.05%)
Mutual labels:  scratch
scratux
A simple project that aims to provide Free/Libre Open Source Linux binaries of Scratch Desktop
Stars: ✭ 88 (+363.16%)
Mutual labels:  scratch

scratch LN

Provide an textual representation of the blocks from scratch 3.0. This text can be used within an html document and using some javascript magic this wil be converted to scratch blocks. Also some function to indicate certain blocks are provided.

Usage

If you are not a developer, you can use the instructions below to use this in your projects. An example can be found: scripts.

The javascript file ScratchLN.js can be found in the dist folder. It is explained below how to use it.

Scratch 3.0 needs the files inside static/blocks-media to render the greenflag,arrows, etc correctly. Therefore, the media property must be set correctly, see below.

Basic scratchify

In the header of the html file add the following.

  <script type="text/javascript" src="ScratchLN.js" charset="utf-8"></script>
  
  <script>
  window.onload = function() {
    scratchLN.scratchify();
  };
  </script>

In html use the code like this:

<pre class="scratch">
<code>
when greenflag clicked
set [teller] to {4}
go to x: {0} y: {0}
pen down
repeat (counter)
move {100} steps
turn cw {({360}/{(counter)})} degrees
end
pen up
</code>
</pre>

When you open the page with a browser it will be rendered as Scratchblocks.

scratchify with arguments

The scratchify-function takes 2 arguments. First, the selector see: https://www.w3schools.com/jquery/jquery_ref_selectors.asp for all possible options. Second a properties object, which can overwrite the default properties of the workspace. The default properties are given below.

{
    //this is exactly the same as blockly/scratchblocks properties
    readOnly: true,
    toolbox: '<xml></xml>',
    scrollbars: false,
    trashcan: false,
    comments: true,
    media: '/static/blocks-media/', //location of the images, sounds, etc.
    colours: {
        fieldShadow: 'rgba(255, 255, 255, 1)' //workspace color
    },
    zoom: {
        startScale: 0.5    //zoomlevel
    },
    
    //extra locale
    locale: "en",  //natural language of the blocks
}

This are the properties for the workspace as defined in Scratchblocks. An extra property locale is added, to define the language of the blocks.

In html some of these properties can be overwritten, namely the locale i.e. the natural language of the blocks, and
the scale this is the size of the blocks. An example:

<code class='scratch' blocks-locale="nl" blocks-scale="1">
    say "hello"
    say {1222};
    say {(varie)};
</code>

Getting Started - development

  1. open a terminal and clone this project.

  2. run npm install

  3. run npm start

  4. in the webbrowser go to:

    • localhost:8008 : live preview: debug
    • localhost:8008\test.html : list of text and the result
    • localhost:8008\blocks.html: generates Scratch-LN text from blocks
    • localhost:8008\example.html : example exercise (teken het cdj logo)
    • localhost:8008\simple.html : simple html

Running tests

  1. go to the root folder
  2. run npm install
  3. run npm test

Generating dist

  1. go to the root folder
  2. run npm install
  3. open webpack.config.js
  4. comment the first part of the export and uncomment the second part.
  5. run webpack

Authors

  • Ellen Vanhove

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].