Commit 259ebc4a authored by Ian Fischer's avatar Ian Fischer

Delete old raw .sky examples since they are no longer valid examples.

R=ianh@google.com, abarth@chromium.org

Review URL: https://codereview.chromium.org/1182993003.
parent d79ef3a6
<sky>
<style>
div {
height: 200px;
background-color: lightblue;
}
</style>
<div id="canvas" />
<script>
import 'dart:math' as math;
import 'dart:sky';
void main() {
var element = document.getElementById('canvas');
element.requestPaint((PaintingContext context) {
Paint paint = new Paint();
paint.color = const Color.fromARGB(128, 0, 255, 0);
double radius = math.min(context.width, context.height) / 2.0;
context.drawCircle(context.width / 2.0, context.height / 2.0, radius, paint);
context.commit();
});
}
</script>
</sky>
<script>
import "dart:math";
import 'dart:sky';
void main() {
double width = window.innerWidth.toDouble();
double height = window.innerHeight.toDouble();
PictureRecorder recorder = new PictureRecorder(width, height);
double radius = min(width, height) * 0.45;
Paint paint = new Paint()..color = const Color.fromARGB(255, 0, 255, 0);
recorder.drawCircle(width / 2, height / 2, radius, paint);
document.rootPicture = recorder.endRecording();
}
</script>
<script>
import "dart:sky";
void main() {
var root = document.createElement('div');
root.style['display'] = 'paragraph';
root.appendChild(new Text('Hello World'));
document.appendChild(root);
root.offsetWidth; // force layout.
double width = window.innerWidth.toDouble();
double height = window.innerHeight.toDouble();
PictureRecorder stampRecorder = new PictureRecorder(width, height);
root.paint(stampRecorder);
Picture stamp = stampRecorder.endRecording();
PictureRecorder recorder = new PictureRecorder(width, height);
Paint paint = new Paint()..color = const Color.fromARGB(255, 0, 255, 0);
recorder.drawCircle(50.0, 50.0, 50.0, paint);
recorder.translate(10.0, 10.0);
recorder.drawPicture(stamp);
recorder.translate(10.0, 10.0);
recorder.drawPicture(stamp);
recorder.translate(10.0, 10.0);
recorder.drawPicture(stamp);
document.rootPicture = recorder.endRecording();
}
</script>
<script>
import "dart:sky";
void main() {
var root = document.createElement('div');
root.style['display'] = 'paragraph';
root.appendChild(new Text('Hello World'));
document.appendChild(root);
root.offsetWidth; // force layout.
double width = window.innerWidth.toDouble();
double height = window.innerHeight.toDouble();
PictureRecorder recorder = new PictureRecorder(width, height);
Paint paint = new Paint()..color = const Color.fromARGB(255, 0, 255, 0);
recorder.drawCircle(50.0, 50.0, 50.0, paint);
recorder.translate(10.0, 10.0);
root.paint(recorder);
recorder.translate(10.0, 10.0);
root.paint(recorder);
recorder.translate(10.0, 10.0);
root.paint(recorder);
document.rootPicture = recorder.endRecording();
}
</script>
<sky>
<style>
div {
height: 200px;
background-color: lightblue;
}
</style>
<div id="canvas" />
<script>
import 'dart:math' as math;
import 'dart:typed_data';
import 'dart:sky';
void main() {
var element = document.getElementById('canvas');
element.requestPaint((PaintingContext context) {
Paint paint = new Paint();
Point mid = new Point(context.width / 2.0, context.height / 2.0);
double radius = math.min(mid.x, mid.y);
context.save();
context.clipRect(new Rect.fromLTRB(0.0, 0.0, context.width, radius));
context.translate(mid.x, mid.y);
paint.color = const Color.fromARGB(128, 255, 0, 255);
context.rotate(math.PI/4.0);
Gradient yellowBlue = new Gradient.linear(
[new Point(-radius, -radius), new Point(0.0, 0.0)],
[const Color(0xFFFFFF00), const Color(0xFF0000FF)]);
context.drawRect(new Rect.fromLTRB(-radius, -radius, radius, radius),
new Paint()..setShader(yellowBlue));
// Scale x and y by 0.5.
var scaleMatrix = new Float32List.fromList([
0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0,
]);
context.concat(scaleMatrix);
paint.color = const Color.fromARGB(128, 0, 255, 0);
context.drawCircle(0.0, 0.0, radius, paint);
context.restore();
context.translate(0.0, 50.0);
var builder = new LayerDrawLooperBuilder()
..addLayerOnTop(
new DrawLooperLayerInfo()
..setOffset(const Point(150.0, 0.0))
..setColorMode(TransferMode.srcMode)
..setPaintBits(PaintBits.all),
(Paint layerPaint) {
layerPaint.color = const Color.fromARGB(128, 255, 255, 0);
layerPaint.setColorFilter(
new ColorFilter.mode(const Color.fromARGB(128, 0, 0, 255),
TransferMode.srcInMode));
layerPaint.setMaskFilter(
new MaskFilter.blur(BlurStyle.normal, 3.0, highQuality: true));
})
..addLayerOnTop(
new DrawLooperLayerInfo()
..setOffset(const Point(75.0, 75.0))
..setColorMode(TransferMode.srcMode)
..setPaintBits(PaintBits.shader),
(Paint layerPaint) {
Gradient redYellow = new Gradient.radial(
new Point(0.0, 0.0), radius/3.0,
[const Color(0xFFFFFF00), const Color(0xFFFF0000)],
null, TileMode.mirror);
layerPaint.setShader(redYellow);
// Since we're don't set PaintBits.maskFilter, this has no effect.
layerPaint.setMaskFilter(
new MaskFilter.blur(BlurStyle.normal, 50.0, highQuality: true));
})
..addLayerOnTop(
new DrawLooperLayerInfo()..setOffset(const Point(225.0, 75.0)),
(Paint layerPaint) {
// Since this layer uses a DST color mode, this has no effect.
layerPaint.color = const Color.fromARGB(128, 255, 0, 0);
});
paint.setDrawLooper(builder.build());
context.drawCircle(0.0, 0.0, radius, paint);
context.commit();
});
}
</script>
</sky>
#!mojo mojo:sky_viewer
<sky>
<style>
square {
margin: 50px;
height: 100px;
width: 100px;
background-color: green;
}
</style>
<square />
<script>
import "dart:sky";
void main() {
Element square = document.querySelector('square');
double timeBase = null;
void animate(double time) {
if (timeBase == null)
timeBase = time;
double delta = time - timeBase;
int rotation = (delta / 10).floor();
square.style["transform"] = "rotate(${rotation}deg)";
window.requestAnimationFrame(animate);
}
window.requestAnimationFrame(animate);
}
</script>
</sky>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment