Clamp to 36-96, which is C2-C7.
This is a temporary fix to prevent errors, until we have a new instrument player implementation, which may have a different range.
Changed mathop to call new math util
Changed sin & cos to round correctly (to get 0)
Added testing for the new math util function
Added testing for the new mathop functions
Had to update the test scripts to handle the alpha channel, also I note
that all the hex tests are using CSS notation, not scratch notation
(which is 0x not #)
Changes include:
- Added missing JSDoc for items in `scratch3_pen.js` and `target.js`.
- Moved constants used by `Scratch3PenBlocks` into the class.
- Created a constant for minimum and maximum pen size.
- Added `util/clone.js` to host cloning functionality.
- Pen blocks now check for the renderer before trying to use it.
- The pen integration test covers all blocks, though `clear`, `stamp`,
and `pen down` will skip some of their functionality when there is no
renderer.
These blocks implement pen features as found in Scratch 2.0
Supporting changes include:
- `Target` is now an event emitter
- `RenderedTarget` now emits an event when it moves
- `Target` can now store arbitrary "extra" data, called "custom state"
in the code, using a `Target`'s `setCustomState` and `getCustomState`
methods. This is used to store per-target pen state without requiring
`Target` or `RenderedTarget` to know anything about the pen.
- `Cast` can now cast to an RGB color object.
- `Color` now has functions to convert between RGB and HSV, constants
for for black & white, and a `mixRgb` function to lerp between two
colors.
* Add "touching" block, layers blocks
* Keep in fence, if on edge bounce, fix to touching edge
* Fix degtoRad in "if on edge, bounce"
* Fixes from review
* Add days since 2000 block
* Empty line addition
* Add semicolin
* Empty line addition
* Tabed
* Remove extra line
* Make it exactly like scratch 2 was
* Fixed spacing
Use it before loading projects so targets don't accumulate when multiple projects are loaded on the same instance.
Move check to see if the clone is the original clone onto the block implementation so all clones can be removed.
Fixes#274
* Implement "go to" block
* Add a missing semicolon
My text editor doesn't automatically insert them and I'm not used to using
semicolons so much. :(
* Implement go-to-random
* Clean up the go-to-random code a bit
* Add rounding to _random_ picks
* Add scratch3_procedures and no-op for defnoreturn
* Add mutation adapter to parse mutations in CREATE/CHANGE events
* Add mutation-to-XML
* Update spec map for Blockly procedure names
* Placeholder for procedure special cases
* Basic stepping to procedures
* Remove extra case
* Validation for changeBlock
* Import lists and variables from SB2
* Switch to Variable and List objects
* Add Clone.lookupOrCreateVariable, Clone.getVariable, Clone.setVariable
* Add (get, set, change) variable blocks.
* Copy variables and lists on clone instantiation
* Move variable options closer to blocks
* Add list primitives
* Move variable and lists storage to `Target` instead of `Clone`
* Move _computeIndex to a Cast function
* Rename `getList` -> `getListAsString`
* Renames renames
* Remove extra check in Cast.isNaN
* Provide property to Clone to distinguish "original" clones
* Provide method to clone a clone's properties
* Don't report clones in the UI target list
* Add target info to Thread
* Allow hats to skip clones (for green flag)
* Green flag skips clones
* Implement "create clone" and hat
* Pass the runtime to sprites and clones (for start hats)
* Clone disposal; trigger hats after drawable initializes.
* Separate stop threads for target; fix handling of stop button
* Remove extraneous `skipClones` property
* Add global clone limit
* Don't allow a non-clone to delete itself.
* Rename `cloneClone` -> `makeClone`
* Variable updates in runtime.js
* Synchronous drawable initialization (until we put it back to promises)
* Fill out color utilities
* Amend Color.decimalToHex name
* Add `Cast.toScaledRgbColor`
* Add touching color, color touching color blocks
* Fix scale of Cast.toRgbColor
* Fix format of colors to use renderer-style lists
* Update `Color.decimalToRgb`
* Lint self
* Add `Clone.prototype.getCostumeIndexByName`, keep in range
* Add basic costume primitives from Scratch 2.0
* Add costume getter block
* Add properties and methods for distinguishing stage and sprites-vs-clones
* Add backdrop-related looks blocks
* Fix up "switch to backdrop" to be working
* Costume/backdrop reporters are 1-indexed
* Fire "when backdrop switched" hats
* Cut cloning helpers for a separate PR
* Disable many blocks on the stage
* Refactor into _setCostumeOrBackdrop; implement switch backdrop and wait
* Fire hats even when backdrop unchanged
* Key pressed hat
* Tabs -> Spaces
* Oops
* Edge activate
* Fix hat
Phew...
* I forgot to change it also here
:/ :/ :\
* Minor fixes for TravisCi
* Minor docs
* Line length