Spec-Zone.ru › Dart 2

dart:html

CanvasGradient class

An opaque canvas object representing a gradient.

Created by calling the methods CanvasRenderingContext2D.createLinearGradient or CanvasRenderingContext2D.createRadialGradient on a CanvasRenderingContext2D object.

Example usage:

var canvas = new CanvasElement(width: 600, height: 600);
var ctx = canvas.context2D;
ctx.clearRect(0, 0, 600, 600);
ctx.save();
// Create radial gradient.
CanvasGradient gradient = ctx.createRadialGradient(0, 0, 0, 0, 0, 600);
gradient.addColorStop(0, '#000');
gradient.addColorStop(1, 'rgb(255, 255, 255)');
// Assign gradients to fill.
ctx.fillStyle = gradient;
// Draw a rectangle with a gradient fill.
ctx.fillRect(0, 0, 600, 600);
ctx.save();
document.body.children.add(canvas);

See also:

  • CanvasGradient from MDN.
  • CanvasGradient from WHATWG.
  • CanvasGradient from W3C.
Annotations
  • @Native("CanvasGradient")

Properties

hashCode → int
read-onlyinherited
The hash code for this object.
runtimeType → Type
read-onlyinherited
A representation of the runtime type of the object.

Methods

addColorStop(num offset, String color) → void
Adds a color stop to this gradient at the offset.
noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed.
toString() → String
inherited
A string representation of this object.

Operators

operator ==(Object other) → bool
inherited
The equality operator.

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.19.6/dart-html/CanvasGradient-class.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API