light property
ComponentSchema<LightComponent>
get
light
Implementation
static ComponentSchema<LightComponent> get light =>
ComponentSchema<LightComponent>(
type: 'LightComponent',
id: 'light_3d_4f9a12d0',
create: LightComponent.new,
hints: ComponentHints(
dimensions: Dimensions.threeD,
name: 'Light',
group: '3D',
description: 'A directional, point or spot light.',
icon: Icons.lightbulb_outline,
accentColor: const Color(0xFFFFCA28),
fields: {
'kind': const FieldHint(label: 'Kind'),
'color': const FieldHint(label: 'Colour'),
'intensity': const FieldHint(
label: 'Intensity',
scrub: ScrubHint(step: 0.5, fractionDigits: 1),
),
'range': FieldHint(
label: 'Range',
scrub: const ScrubHint(step: 0.5, fractionDigits: 1, suffix: 'm'),
visibleWhen: (c) =>
(c as LightComponent).kind != LightKind.directional,
),
'innerConeAngle': FieldHint(
label: 'Inner cone',
unit: AngleUnit.degrees,
scrub: const ScrubHint(step: 1, fractionDigits: 0, suffix: '°'),
visibleWhen: (c) => (c as LightComponent).kind == LightKind.spot,
),
'outerConeAngle': FieldHint(
label: 'Outer cone',
unit: AngleUnit.degrees,
scrub: const ScrubHint(step: 1, fractionDigits: 0, suffix: '°'),
visibleWhen: (c) => (c as LightComponent).kind == LightKind.spot,
),
},
),
fields: [
SchemaField(
name: 'kind',
kind: const EnumFieldType(
LightKind.values,
fallback: LightKind.point,
id: 'graphics.lightKind',
),
read: (c) => (c as LightComponent).kind,
write: (c, v) => (c as LightComponent).kind = v as LightKind,
),
SchemaField(
name: 'color',
kind: FieldTypes.color,
read: (c) => (c as LightComponent).color,
write: (c, v) => (c as LightComponent).color = v as Color,
),
_decimal(
'intensity',
(c) => (c as LightComponent).intensity,
(c, v) => (c as LightComponent).intensity = v,
min: 0,
),
_decimal(
'range',
(c) => (c as LightComponent).range,
(c, v) => (c as LightComponent).range = v,
min: 0,
),
_decimal(
'innerConeAngle',
(c) => (c as LightComponent).innerConeAngle,
(c, v) => (c as LightComponent).innerConeAngle = v,
min: 0,
),
_decimal(
'outerConeAngle',
(c) => (c as LightComponent).outerConeAngle,
(c, v) => (c as LightComponent).outerConeAngle = v,
min: 0,
),
],
);