123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- 'use strict';
- goog.provide('Blockly.Blocks.color');
- goog.require('Blockly.Blocks');
- goog.require('Blockly.Types');
- Blockly.Blocks.color.HUE = 330;
- Blockly.Blocks['color_analyzer_setup'] = {
- init: function() {
- this.appendDummyInput()
- // .appendField(new Blockly.FieldImage("http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_colorAnalyzer.png", 140, 40, "0"));
- .appendField(new Blockly.FieldImage("./../blockly/media/main-color.png", 50, 40, "0"));
- this.appendDummyInput()
- .appendField(Blockly.Msg.COLORANALYZER_SETUP);
- this.setColour(Blockly.Blocks.color.HUE);
- this.setTooltip('');
- this.setHelpUrl('');
- }
- };
- Blockly.Blocks['set_color'] = {
- init: function() {
- this.appendDummyInput()
- .appendField(Blockly.Msg.COLOR)
- .appendField(new Blockly.FieldColour("#ff0000"), "COLOR");
- this.setOutput(true, "String");
- this.setColour(Blockly.Blocks.color.HUE);
- this.setTooltip("");
- this.setHelpUrl("");
- }
- };
- Blockly.Blocks['read_r'] = {
- init: function() {
- this.appendDummyInput()
- .appendField(Blockly.Msg.READ_R);
- this.setOutput(true, Blockly.Types.NUMBER.output);
- this.setColour(Blockly.Blocks.color.HUE);
- this.setTooltip("");
- this.setHelpUrl("");
- },
- getBlockType: function() {
- return Blockly.Types.NUMBER;
- }
- }
- Blockly.Blocks['read_g'] = {
- init: function() {
- this.appendDummyInput()
- .appendField(Blockly.Msg.READ_G);
- this.setOutput(true, Blockly.Types.NUMBER.output);
- this.setColour(Blockly.Blocks.color.HUE);
- this.setTooltip("");
- this.setHelpUrl("");
- },
- getBlockType: function() {
- return Blockly.Types.NUMBER;
- }
- }
- Blockly.Blocks['read_b'] = {
- init: function() {
- this.appendDummyInput()
- .appendField(Blockly.Msg.READ_B);
- this.setOutput(true, Blockly.Types.NUMBER.output);
- this.setColour(Blockly.Blocks.color.HUE);
- this.setTooltip("");
- this.setHelpUrl("");
- },
- getBlockType: function() {
- return Blockly.Types.NUMBER;
- }
- }
- Blockly.Blocks['set_colorRGB'] = {
- init: function() {
- this.appendDummyInput()
- .appendField(Blockly.Msg.COLOR);
- this.appendValueInput("RED_VAL")
- .setCheck(null)
- .appendField(Blockly.Msg.RED);
- this.appendValueInput("GREEN_VAL")
- .setCheck(null)
- .appendField(Blockly.Msg.GREEN);
- this.appendValueInput("BLUE_VAL")
- .setCheck(null)
- .appendField(Blockly.Msg.BLUE);
- this.setInputsInline(true);
- this.setOutput(true, "String");
- this.setColour(Blockly.Blocks.color.HUE);
- this.setTooltip("");
- this.setHelpUrl("http://help.cocorobo.cn/#/cocomod/color-analyzer?id=rgb-%E5%8F%96%E8%89%B2%E5%99%A8");
- }
- }
- Blockly.Blocks['isColorRGB'] = {
- init: function() {
- this.appendDummyInput()
- .appendField(Blockly.Msg.ISCOLOR)
- .appendField(new Blockly.FieldDropdown([
- [Blockly.Msg.RED, "r"],
- [Blockly.Msg.GREEN, "g"],
- [Blockly.Msg.BLUE, "b"]
- ]), "COLOR");
- this.setOutput(true, "Boolean");
- this.setColour(Blockly.Blocks.color.HUE);
- this.setTooltip("");
- this.setHelpUrl("http://help.cocorobo.cn/#/cocomod/color-analyzer?id=rgb-%E5%8F%96%E8%89%B2%E5%99%A8");
- }
- }
|