Merge branch 'master' of github.com:Microsoft/kindscript-microbit
This commit is contained in:
commit
30a0dfb9a1
@ -25,7 +25,7 @@ namespace images {
|
||||
*/
|
||||
//% help=images/show-image weight=80 shim=micro_bit::showImage
|
||||
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
||||
public showImage(xOffset: number): void {}
|
||||
public showImage(xOffset: number = 0): void {}
|
||||
|
||||
/**
|
||||
* Scrolls an image .
|
||||
@ -34,15 +34,28 @@ namespace images {
|
||||
*/
|
||||
//% help=images/show-image weight=79 shim=micro_bit::scrollImage async
|
||||
//% blockId=device_scroll_image block="scroll image %sprite|with offset %frameoffset|and interval (ms) %delay" blockGap=8
|
||||
public scrollImage(frameOffset: number, interval : number = 200) {
|
||||
public scrollImage(frameOffset: number = 0, interval : number = 200) {
|
||||
}
|
||||
|
||||
public plotImage(xOffset: number): void {}
|
||||
|
||||
/**
|
||||
* Plots the image at a given column to the screen
|
||||
*/
|
||||
public plotImage(xOffset: number = 0): void {}
|
||||
|
||||
/**
|
||||
* Sets all pixels off.
|
||||
*/
|
||||
public clear(): void {}
|
||||
|
||||
/**
|
||||
* Sets a specific pixel brightness at a given position
|
||||
*/
|
||||
public setPixelBrightness(x: number, y: number, v: number): void {}
|
||||
|
||||
/**
|
||||
* Gets the pixel brightness ([0..255]) at a given position
|
||||
*/
|
||||
public pixelBrightness(x: number, y: number): number {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,86 +0,0 @@
|
||||
svg.sim {
|
||||
margin-bottom:1em;
|
||||
}
|
||||
.sim-button {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sim-button-outer:hover {
|
||||
stroke:grey;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.sim-pin:hover {
|
||||
stroke:#D4AF37;
|
||||
stroke-width:2px;
|
||||
}
|
||||
|
||||
.sim-pin-touch.touched:hover {
|
||||
stroke:darkorange;
|
||||
}
|
||||
|
||||
.sim-led-back:hover {
|
||||
stroke:#a0a0a0;
|
||||
stroke-width:3px;
|
||||
}
|
||||
.sim-led:hover {
|
||||
stroke:#ff7f7f;
|
||||
stroke-width:3px;
|
||||
}
|
||||
|
||||
.sim-systemled {
|
||||
fill:#333;
|
||||
stroke:#555;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.sim-light-level-button {
|
||||
stroke:#fff;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.sim-antenna {
|
||||
stroke:#555;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.sim-text {
|
||||
font-family:monospace;
|
||||
font-size:25px;
|
||||
fill:#fff;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sim-text-pin {
|
||||
font-family:monospace;
|
||||
font-size:20px;
|
||||
fill:#fff;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sim-thermometer {
|
||||
stroke:#aaa;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
/* animations */
|
||||
.sim-flash {
|
||||
animation-name: sim-flash-animation;
|
||||
animation-duration: 0.1s;
|
||||
}
|
||||
|
||||
@keyframes sim-flash-animation {
|
||||
from { fill: yellow; }
|
||||
to { fill: default; }
|
||||
}
|
||||
|
||||
.sim-flash-stroke {
|
||||
animation-name: sim-flash-stroke-animation;
|
||||
animation-duration: 0.4s;
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
|
||||
@keyframes sim-flash-stroke-animation {
|
||||
from { stroke: yellow; }
|
||||
to { stroke: default; }
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>microbit simulator</title>
|
||||
<link rel="stylesheet" type="text/css" href="./sim.css">
|
||||
<style>
|
||||
body {
|
||||
background: transparent;
|
||||
|
101
sim/simsvg.ts
101
sim/simsvg.ts
@ -162,6 +162,7 @@ namespace ks.rt.micro_bit {
|
||||
export class MicrobitBoardSvg
|
||||
{
|
||||
public element : SVGSVGElement;
|
||||
private style: SVGStyleElement;
|
||||
private defs : SVGDefsElement;
|
||||
private g: SVGElement;
|
||||
|
||||
@ -239,6 +240,9 @@ namespace ks.rt.micro_bit {
|
||||
this.updateTemperature();
|
||||
this.updateButtonAB();
|
||||
this.updateGestures();
|
||||
|
||||
if (!runtime || runtime.dead) this.element.classList.add("grayscale");
|
||||
else this.element.classList.remove("grayscale");
|
||||
}
|
||||
|
||||
private updateGestures() {
|
||||
@ -459,6 +463,103 @@ namespace ks.rt.micro_bit {
|
||||
"class":"sim",
|
||||
"x": "0px",
|
||||
"y": "0px"});
|
||||
this.style = <SVGStyleElement>Svg.child(this.element, "style", {});
|
||||
this.style.textContent = `
|
||||
svg.sim {
|
||||
margin-bottom:1em;
|
||||
}
|
||||
svg.sim.grayscale {
|
||||
-moz-filter: grayscale(1);
|
||||
-webkit-filter: grayscale(1);
|
||||
filter: grayscale(1);
|
||||
}
|
||||
.sim-button {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sim-button-outer:hover {
|
||||
stroke:grey;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.sim-pin:hover {
|
||||
stroke:#D4AF37;
|
||||
stroke-width:2px;
|
||||
}
|
||||
|
||||
.sim-pin-touch.touched:hover {
|
||||
stroke:darkorange;
|
||||
}
|
||||
|
||||
.sim-led-back:hover {
|
||||
stroke:#a0a0a0;
|
||||
stroke-width:3px;
|
||||
}
|
||||
.sim-led:hover {
|
||||
stroke:#ff7f7f;
|
||||
stroke-width:3px;
|
||||
}
|
||||
|
||||
.sim-systemled {
|
||||
fill:#333;
|
||||
stroke:#555;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.sim-light-level-button {
|
||||
stroke:#fff;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.sim-antenna {
|
||||
stroke:#555;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.sim-text {
|
||||
font-family:monospace;
|
||||
font-size:25px;
|
||||
fill:#fff;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sim-text-pin {
|
||||
font-family:monospace;
|
||||
font-size:20px;
|
||||
fill:#fff;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sim-thermometer {
|
||||
stroke:#aaa;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
/* animations */
|
||||
.sim-flash {
|
||||
animation-name: sim-flash-animation;
|
||||
animation-duration: 0.1s;
|
||||
}
|
||||
|
||||
@keyframes sim-flash-animation {
|
||||
from { fill: yellow; }
|
||||
to { fill: default; }
|
||||
}
|
||||
|
||||
.sim-flash-stroke {
|
||||
animation-name: sim-flash-stroke-animation;
|
||||
animation-duration: 0.4s;
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
|
||||
@keyframes sim-flash-stroke-animation {
|
||||
from { stroke: yellow; }
|
||||
to { stroke: default; }
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
|
||||
this.defs = <SVGDefsElement>Svg.child(this.element, "defs", {});
|
||||
this.g = Svg.elt("g");
|
||||
this.element.appendChild(this.g);
|
||||
|
Loading…
Reference in New Issue
Block a user