Ortak türler
View özelliklerine, veri türlerine ve kod örneklerine bakın.
ViewContent
Çizilebilir Views, temel değerler veya iç içe diziler; null/undefined içerik üretmez.
type ViewContent =
View | string | number | boolean | null | undefined | ViewContent[];
Örnek
const example: ViewContent = ['Speed', 78, null];
TextContent
Metin toString() ile dönüşür; null/undefined boştur. Simgeleri başka Views ile birleştirin.
type TextContent =
| string
| number
| bigint
| boolean
| symbol
| { toString(): string }
| null
| undefined;
Örnek
const example: TextContent = {
toString() {
return '78 km/h';
},
};
HDRColor
Çizim renkleri ve gradyanlar için HDR renk verileri.
type HDRColor = { readonly $type: 'CapDrive.HDR'; readonly color: string };
Örnek
const example: HDRColor = HDR('white');
RGBColor
r/g/b ve isteğe bağlı a, 0–1; space, srgb veya displayP3 seçer.
type RGBColor = {
space?: 'srgb' | 'displayP3';
r: number;
g: number;
b: number;
a?: number;
};
Örnek
const example: RGBColor = {
space: 'displayP3',
r: 0.2,
g: 0.7,
b: 0.6,
a: 0.8,
};
Color
Renk adı, onaltılık dize, RGBColor veya HDR() rengi.
type Color = string | RGBColor | HDRColor;
Örnek
const example: Color = '#30B3A2';
ViewPoint
Ekran puntosuyla yerel x/y koordinatı; enlem/boylam değildir.
type ViewPoint = { x: number; y: number };
Örnek
const example: ViewPoint = { x: 20, y: 40 };
ChartDataPoint
value.x/y konumu, label.x/y yazıyı belirler; y null çizgiyi böler.
type ChartDataPoint = {
value: { x: number; y: number | null };
label: { x: string; y: string };
};
Örnek
const example: ChartDataPoint = {
value: { x: 12, y: null },
label: { x: '12s', y: '' },
};
ChartRange
Sayısal aralık [min, max]; indeks veya etiket değildir.
type ChartRange = readonly [min: number, max: number];
Örnek
const example: ChartRange = [-20, 100];
MapCoordinate
Coğrafi latitude ve longitude, derece.
type MapCoordinate = { latitude: number; longitude: number };
Örnek
const example: MapCoordinate = { latitude: 31.2304, longitude: 121.4737 };
MapPathStyle
Yerel rota stili: Color, kalınlık, uç, birleşim, kesik çizgi, dış çizgi ve isteğe bağlı uç işaretleri. Gradyan desteklenmez.
type MapPathStyle = {
stroke?: Color;
lineWidth?: number;
lineCap?: 'round' | 'butt' | 'square';
lineJoin?: 'round' | 'miter' | 'bevel';
dash?: readonly number[];
dashPhase?: number;
outlineStroke?: Color;
outlineWidth?: number;
showEndpoints?: boolean;
};
Örnek
const example: MapPathStyle = {
stroke: '#30B3A2',
lineWidth: 4,
outlineStroke: 'white',
outlineWidth: 1,
showEndpoints: true,
};
ChartAxisStyle
Eksen rengi, kalınlığı, uçları ve kesikleri. clear çizgiyi gizler; etiketler ayrı kontrol edilir.
type ChartAxisStyle = {
stroke?: Paint;
lineWidth?: number;
lineCap?: 'round' | 'butt' | 'square';
dash?: readonly number[];
dashPhase?: number;
};
Örnek
const example: ChartAxisStyle = {
stroke: '#888888',
lineWidth: 1,
dash: [4, 3],
};
BarChartDataPoint
Bir çubuğun sayısal value ve isteğe bağlı label değeri; dizi sırası konumu belirler.
type BarChartDataPoint = { value: number; label?: string };
Örnek
const example: BarChartDataPoint = { value: -25, label: 'B' };
PathCommand
move, line, quad, cubic, arc, close komutları. Koordinat/yarıçap punto, açı derece.
type PathCommand =
| { op: 'move'; x: number; y: number }
| { op: 'line'; x: number; y: number }
| { op: 'quad'; x: number; y: number; cx: number; cy: number }
| {
op: 'cubic';
x: number;
y: number;
c1x: number;
c1y: number;
c2x: number;
c2y: number;
}
| {
op: 'arc';
x: number;
y: number;
radius: number;
startAngle: number;
sweepAngle: number;
}
| { op: 'close' };
Örnek
const example: PathCommand = {
op: 'cubic',
x: 100,
y: 60,
c1x: 20,
c1y: 0,
c2x: 80,
c2y: 100,
};
GradientStop
Renk veya gradyanda 0–1 location içeren renk nesnesi.
type GradientStop = Color | { color: Color; location: number };
Örnek
const example: GradientStop = { color: '#30B3A2', location: 0.7 };
GradientColors
Sıralı renkler/duraklar; düz renkler eşit aralıklarla yerleştirilir.
type GradientColors = ReadonlyArray<GradientStop>;
Örnek
const example: GradientColors = [
{ color: 'red', location: 0 },
{ color: 'blue', location: 1 },
];
LinearGradientOptions
Doğrusal gradyan: angle derece, center normalize; (0.5, 0.5) ortadır.
type LinearGradientOptions = { angle?: number; center?: ViewPoint };
Örnek
const example: LinearGradientOptions = {
angle: 90,
center: { x: 0.5, y: 0.5 },
};
RadialGradientOptions
Radyal gradyan: startRadius/endRadius punto, center normalize.
type RadialGradientOptions = {
startRadius?: number;
endRadius?: number;
center?: ViewPoint;
};
Örnek
const example: RadialGradientOptions = {
startRadius: 0,
endRadius: 60,
center: { x: 0.5, y: 0.5 },
};
AngularGradientOptions
Açısal gradyan: angle derece, center normalize.
type AngularGradientOptions = { angle?: number; center?: ViewPoint };
Örnek
const example: AngularGradientOptions = {
angle: -90,
center: { x: 0.5, y: 0.5 },
};
Gradient
LinearGradient, RadialGradient veya AngularGradient çıktısı; new ile veya onsuz çağrılır.
type Gradient = {
readonly type: 'linear' | 'radial' | 'angular';
readonly angle?: number;
readonly startRadius?: number;
readonly endRadius?: number;
readonly center?: ViewPoint;
readonly colors: GradientColors;
};
Örnek
const example: Gradient = LinearGradient(['red', 'blue'], { angle: 90 });
Paint
Çizim boyası: Color veya Gradient.
type Paint = Color | Gradient;
Örnek
const example: Paint = RadialGradient(['white', '#30B3A2'], {
endRadius: 60,
});
DrawingEffect
Efekt rengi, opaklığı, bulanıklık yarıçapı ve x/y kayması; uzaklıklar punto.
type DrawingEffect = {
color?: Color;
opacity?: number;
radius?: number;
x?: number;
y?: number;
};
Örnek
const example: DrawingEffect = {
color: 'cyan',
opacity: 0.6,
radius: 8,
x: 0,
y: 2,
};
ViewTransform
Yerleşimi değiştirmeyen bütünsel dönüşüm. Kaydırma punto, dönüş/eğim derece, ölçek 1 değişmez, dayanak 0–1.
type ViewTransform = {
translateX?: number;
translateY?: number;
scaleX?: number;
scaleY?: number;
rotation?: number;
skewX?: number;
skewY?: number;
anchorX?: number;
anchorY?: number;
};
Örnek
const example: ViewTransform = {
rotation: 30,
scaleX: 1.2,
scaleY: 1.2,
anchorX: 0.5,
anchorY: 0.5,
};
RepeatAxisValue
Aktif eksenler için sayı veya ayrı x/y değerleri.
type RepeatAxisValue = number | { x?: number; y?: number };
Örnek
const example: RepeatAxisValue = { x: 120, y: 80 };
AnimationProperty
Animasyon özelliği adı veya iç içe yol; her View kendi alt kümesini destekler.
type AnimationProperty =
| 'width'
| 'height'
| 'padding'
| 'x'
| 'y'
| 'opacity'
| 'cornerRadius'
| 'blur'
| 'shadowOpacity'
| 'shadowRadius'
| 'shadowX'
| 'shadowY'
| 'fontSize'
| 'letterSpacing'
| 'minimumScaleFactor'
| 'spacing'
| 'radius'
| 'radiusX'
| 'radiusY'
| 'startAngle'
| 'sweepAngle'
| 'lineWidth'
| 'dashPhase'
| 'trimStart'
| 'trimEnd'
| 'barThickness'
| 'value'
| 'offset'
| 'anchor'
| 'period'
| 'minLength'
| 'color'
| 'stroke'
| 'background'
| 'shadowColor'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY'
| 'period.x'
| 'period.y'
| 'value.x'
| 'value.y'
| 'anchor.x'
| 'anchor.y'
| 'offset.x'
| 'offset.y'
| 'start.x'
| 'start.y'
| 'end.x'
| 'end.y'
| 'rangeX.0'
| 'rangeX.1'
| 'rangeY.0'
| 'rangeY.1'
| 'xAxis.lineWidth'
| 'xAxis.dashPhase'
| 'yAxis.lineWidth'
| 'yAxis.dashPhase'
| 'xAxis.stroke'
| 'yAxis.stroke'
| 'regionOffset.x'
| 'regionOffset.y'
| 'pathStyle.lineWidth'
| 'pathStyle.outlineWidth'
| 'pathStyle.dashPhase'
| 'pathStyle.stroke'
| 'pathStyle.outlineStroke';
Örnek
const example: AnimationProperty = 'transform.rotation';
Animation
Özellik değişimini canlandırır. duration/delay saniye; from/to uçlar; repeat/autoreverse tekrar, wrap dönem.
type Animation = {
property: AnimationProperty;
duration?: number;
delay?: number;
curve?: string;
from?: number | Color;
to?: number | Color;
repeat?: number | 'forever';
autoreverse?: boolean;
wrap?: number;
};
Örnek
const example: Animation = {
property: 'opacity',
duration: 0.25,
curve: 'easeOut',
};
CircleAnimation
Kavis animasyonu: sweepAngle wrap desteklemez; startAngle wrap: 360 kabul eder.
type CircleAnimation =
| (Omit<Animation, 'property'> & {
property:
| 'width'
| 'height'
| 'x'
| 'y'
| 'opacity'
| 'background'
| 'blur'
| 'shadowColor'
| 'shadowOpacity'
| 'shadowRadius'
| 'shadowX'
| 'shadowY'
| 'dashPhase'
| 'stroke'
| 'lineWidth'
| 'startAngle'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY';
})
| (Omit<Animation, 'property' | 'wrap' | 'from' | 'to'> & {
property: 'sweepAngle';
from?: number;
to?: number;
wrap?: never;
});
Örnek
const example: CircleAnimation = {
property: 'sweepAngle',
duration: 0.3,
from: 0,
to: 270,
};
EllipseAnimation
Kavis animasyonu: sweepAngle wrap desteklemez; startAngle wrap: 360 kabul eder.
type EllipseAnimation =
| (Omit<Animation, 'property'> & {
property:
| 'width'
| 'height'
| 'x'
| 'y'
| 'opacity'
| 'background'
| 'blur'
| 'shadowColor'
| 'shadowOpacity'
| 'shadowRadius'
| 'shadowX'
| 'shadowY'
| 'dashPhase'
| 'stroke'
| 'lineWidth'
| 'startAngle'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY';
})
| (Omit<Animation, 'property' | 'wrap' | 'from' | 'to'> & {
property: 'sweepAngle';
from?: number;
to?: number;
wrap?: never;
});
Örnek
const example: EllipseAnimation = {
property: 'startAngle',
duration: 0.3,
wrap: 360,
};
ArcAnimation
Kavis animasyonu: sweepAngle wrap desteklemez; startAngle wrap: 360 kabul eder.
type ArcAnimation =
| (Omit<Animation, 'property'> & {
property:
| 'width'
| 'height'
| 'x'
| 'y'
| 'opacity'
| 'background'
| 'blur'
| 'shadowColor'
| 'shadowOpacity'
| 'shadowRadius'
| 'shadowX'
| 'shadowY'
| 'dashPhase'
| 'stroke'
| 'lineWidth'
| 'startAngle'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY';
})
| (Omit<Animation, 'property' | 'wrap' | 'from' | 'to'> & {
property: 'sweepAngle';
from?: number;
to?: number;
wrap?: never;
});
Örnek
const example: ArcAnimation = {
property: 'sweepAngle',
duration: 0.3,
from: 0,
to: -180,
};
MapAnimation
Harita ve rota stilinin desteklenen özelliklerini canlandırır; kamera için ayrı cameraAnimation vardır.
type MapAnimation =
| (Omit<Animation, 'property' | 'from' | 'to'> & {
property:
| 'width'
| 'height'
| 'x'
| 'y'
| 'opacity'
| 'cornerRadius'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY'
| 'regionOffset.x'
| 'regionOffset.y'
| 'pathStyle.lineWidth'
| 'pathStyle.outlineWidth'
| 'pathStyle.dashPhase';
from?: number;
to?: number;
})
| (Omit<Animation, 'property' | 'from' | 'to' | 'wrap'> & {
property: 'pathStyle.stroke' | 'pathStyle.outlineStroke';
from?: Color;
to?: Color;
wrap?: never;
});
Örnek
const example: MapAnimation = {
property: 'pathStyle.stroke',
duration: 0.25,
from: 'red',
to: 'blue',
};
LineChartAnimation
Grafik aralıkları ve eksen stilleri de canlandırılır; aralıkta wrap yok, renk yollarında renk kullanılır.
type LineChartAnimation =
| (Omit<Animation, 'property'> & {
property:
| 'width'
| 'height'
| 'x'
| 'y'
| 'opacity'
| 'blur'
| 'shadowColor'
| 'shadowOpacity'
| 'shadowRadius'
| 'shadowX'
| 'shadowY'
| 'stroke'
| 'lineWidth'
| 'dashPhase'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY';
})
| (Omit<Animation, 'property' | 'wrap' | 'from' | 'to'> & {
property: 'rangeX.0' | 'rangeX.1' | 'rangeY.0' | 'rangeY.1';
from?: number;
to?: number;
wrap?: never;
})
| (Omit<Animation, 'property' | 'from' | 'to'> & {
property:
| 'xAxis.lineWidth'
| 'xAxis.dashPhase'
| 'yAxis.lineWidth'
| 'yAxis.dashPhase';
from?: number;
to?: number;
})
| (Omit<Animation, 'property' | 'from' | 'to' | 'wrap'> & {
property: 'xAxis.stroke' | 'yAxis.stroke';
from?: Color;
to?: Color;
wrap?: never;
});
Örnek
const example: LineChartAnimation = { property: 'rangeX.1', duration: 0.25 };
BarChartAnimation
Grafik aralıkları ve eksen stilleri de canlandırılır; aralıkta wrap yok, renk yollarında renk kullanılır.
type BarChartAnimation =
| (Omit<Animation, 'property'> & {
property:
| 'width'
| 'height'
| 'x'
| 'y'
| 'opacity'
| 'background'
| 'cornerRadius'
| 'blur'
| 'shadowColor'
| 'shadowOpacity'
| 'shadowRadius'
| 'shadowX'
| 'shadowY'
| 'barThickness'
| 'stroke'
| 'lineWidth'
| 'dashPhase'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY';
})
| (Omit<Animation, 'property' | 'wrap' | 'from' | 'to'> & {
property: 'rangeY.0' | 'rangeY.1';
from?: number;
to?: number;
wrap?: never;
})
| (Omit<Animation, 'property' | 'from' | 'to'> & {
property:
| 'xAxis.lineWidth'
| 'xAxis.dashPhase'
| 'yAxis.lineWidth'
| 'yAxis.dashPhase';
from?: number;
to?: number;
})
| (Omit<Animation, 'property' | 'from' | 'to' | 'wrap'> & {
property: 'xAxis.stroke' | 'yAxis.stroke';
from?: Color;
to?: Color;
wrap?: never;
});
Örnek
const example: BarChartAnimation = { property: 'rangeY.1', duration: 0.25 };
RadialLayoutAnimation
Kavis animasyonu: sweepAngle wrap desteklemez; startAngle wrap: 360 kabul eder.
type RadialLayoutAnimation =
| (Omit<Animation, 'property'> & {
property:
| 'width'
| 'height'
| 'padding'
| 'x'
| 'y'
| 'opacity'
| 'background'
| 'cornerRadius'
| 'blur'
| 'shadowColor'
| 'shadowOpacity'
| 'shadowRadius'
| 'shadowX'
| 'shadowY'
| 'radius'
| 'radiusX'
| 'radiusY'
| 'startAngle'
| 'transform.translateX'
| 'transform.translateY'
| 'transform.scaleX'
| 'transform.scaleY'
| 'transform.rotation'
| 'transform.skewX'
| 'transform.skewY'
| 'transform.anchorX'
| 'transform.anchorY';
})
| (Omit<Animation, 'property' | 'wrap' | 'from' | 'to'> & {
property: 'sweepAngle';
from?: number;
to?: number;
wrap?: never;
});
Örnek
const example: RadialLayoutAnimation = {
property: 'startAngle',
duration: 0.25,
wrap: 360,
};
SpacerAnimation
Spacer yalnızca width, height ve minLength canlandırır; görsel efekt yoktur.
type SpacerAnimation = {
property: 'width' | 'height' | 'minLength';
duration?: number;
delay?: number;
curve?: string;
from?: number;
to?: number;
repeat?: number | 'forever';
autoreverse?: boolean;
wrap?: number;
};
Örnek
const example: SpacerAnimation = {
property: 'minLength',
duration: 0.25,
from: 8,
to: 24,
};
ContentAnimation
İçerik değişimi geçişi. Desteklenen type seçilir; duration/delay saniyedir.
type ContentAnimation = {
type: 'fade' | 'slide' | 'scale' | 'numericText' | 'interpolate';
duration?: number;
delay?: number;
curve?: string;
direction?: string;
distance?: number;
scale?: number;
};
Örnek
const example: ContentAnimation = { type: 'numericText', duration: 0.18 };
ViewSize
Ölçülen width ve height, ekran puntosu.
type ViewSize = { width: number; height: number };
Örnek
const example: ViewSize = { width: 240, height: 140 };
ViewInsets
top, leading, bottom, trailing boşlukları, punto.
type ViewInsets = {
top: number;
leading: number;
bottom: number;
trailing: number;
};
Örnek
const example: ViewInsets = {
top: 24,
leading: 12,
bottom: 12,
trailing: 12,
};
CardContentMetrics
renderer’a verilen size, contentSize, headerSize, safeInsets ile içerik başlıktan uzak yerleştirilir.
type CardContentMetrics = {
size: ViewSize;
contentSize: ViewSize;
headerSize: ViewSize;
safeInsets: ViewInsets;
};
Örnek
const example: CardContentMetrics = {
size: { width: 240, height: 160 },
contentSize: { width: 216, height: 124 },
headerSize: { width: 216, height: 24 },
safeInsets: { top: 24, leading: 12, bottom: 12, trailing: 12 },
};