diff --git a/examples/game/lib/transform_node.dart b/examples/game/lib/transform_node.dart index e5bc444001..199ca55f80 100644 --- a/examples/game/lib/transform_node.dart +++ b/examples/game/lib/transform_node.dart @@ -123,7 +123,7 @@ class TransformNode { canvas.save(); canvas.translate(_position[0], _position[1]); - canvas.rotateDegrees(_rotation); + canvas.rotate(degrees2radians(_rotation)); canvas.translate(-_width*_pivot[0], -_height*_pivot[1]); // TODO: Use transformation matrix instead of individual calls @@ -147,4 +147,4 @@ class TransformNode { void update(double dt) { } -} \ No newline at end of file +} diff --git a/examples/raw/painting.sky b/examples/raw/painting.sky index b0731a9559..ffcb4a4108 100644 --- a/examples/raw/painting.sky +++ b/examples/raw/painting.sky @@ -24,7 +24,7 @@ void main() { context.translate(mid.x, mid.y); paint.color = const Color.fromARGB(128, 255, 0, 255); - context.rotateDegrees(45.0); + context.rotate(math.PI/4.0); Gradient yellowBlue = new Gradient.Linear( [new Point(-radius, -radius), new Point(0.0, 0.0)], diff --git a/examples/raw/sector_layout.dart b/examples/raw/sector_layout.dart index 1c8ed3fdf6..aa87ac7f7e 100644 --- a/examples/raw/sector_layout.dart +++ b/examples/raw/sector_layout.dart @@ -10,8 +10,6 @@ import 'package:sky/framework/rendering/object.dart'; const double kTwoPi = 2 * math.PI; -double deg(double radians) => radians * 180.0 / math.PI; - class SectorConstraints { const SectorConstraints({ this.minDeltaRadius: 0.0, @@ -128,10 +126,10 @@ class RenderDecoratedSector extends RenderSector { Path path = new Path(); double outerRadius = (parentData.radius + deltaRadius); Rect outerBounds = new Rect.fromLTRB(-outerRadius, -outerRadius, outerRadius, outerRadius); - path.arcTo(outerBounds, deg(parentData.theta), deg(deltaTheta), true); + path.arcTo(outerBounds, parentData.theta, deltaTheta, true); double innerRadius = parentData.radius; Rect innerBounds = new Rect.fromLTRB(-innerRadius, -innerRadius, innerRadius, innerRadius); - path.arcTo(innerBounds, deg(parentData.theta + deltaTheta), deg(-deltaTheta), false); + path.arcTo(innerBounds, parentData.theta + deltaTheta, -deltaTheta, false); path.close(); canvas.drawPath(path, paint); } diff --git a/examples/raw/spinning_image.dart b/examples/raw/spinning_image.dart index b79162a2c0..cdbf7f6782 100644 --- a/examples/raw/spinning_image.dart +++ b/examples/raw/spinning_image.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:math' as math; import 'dart:sky'; import 'package:sky/framework/net/image_cache.dart' as image_cache; @@ -16,7 +17,7 @@ void beginFrame(double timeStamp) { double delta = timeStamp - timeBase; PictureRecorder canvas = new PictureRecorder(view.width, view.height); canvas.translate(view.width / 2.0, view.height / 2.0); - canvas.rotateDegrees(delta / 10); + canvas.rotate(math.PI * delta / 1800); canvas.scale(0.2, 0.2); Paint paint = new Paint()..setARGB(255, 0, 255, 0); if (image != null) diff --git a/examples/raw/spinning_square.dart b/examples/raw/spinning_square.dart index dbc0140d08..97c3c7ab41 100644 --- a/examples/raw/spinning_square.dart +++ b/examples/raw/spinning_square.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:sky'; +import 'dart:math' as math; double timeBase = null; @@ -13,7 +14,7 @@ void beginFrame(double timeStamp) { double delta = timeStamp - timeBase; PictureRecorder canvas = new PictureRecorder(view.width, view.height); canvas.translate(view.width / 2.0, view.height / 2.0); - canvas.rotateDegrees(delta / 10); + canvas.rotate(math.PI * delta / 1800); canvas.drawRect(new Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), new Paint()..setARGB(255, 0, 255, 0)); view.picture = canvas.endRecording(); diff --git a/examples/spinning_arabic.dart b/examples/spinning_arabic.dart index e42c2f4a45..25dea11402 100644 --- a/examples/spinning_arabic.dart +++ b/examples/spinning_arabic.dart @@ -14,7 +14,7 @@ void beginFrame(double timeStamp) { double delta = timeStamp - timeBase; PictureRecorder canvas = new PictureRecorder(view.width, view.height); canvas.translate(view.width / 2.0, view.height / 2.0); - canvas.rotateDegrees(delta / 10); + canvas.rotate(math.PI * delta / 1800); canvas.drawRect(new Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), new Paint()..setARGB(255, 0, 255, 0));