pub struct PropertyAnimation {
pub property: String,
pub start_value: PropValue,
pub stop_value: PropValue,
pub duration: f32,
pub delay: f32,
pub easing: Easing,
pub trigger: Trigger,
pub auto_reverse: bool,
pub looping: bool,
pub enabled: bool,
pub keyframes: String,
/* private fields */
}Expand description
Animação declarada como componente filho do controle animado. Funciona sem código, inclusive vinda do arquivo de layout.
let anim = ui.add(PropertyAnimation::color("fill", Color::rgb(255, 0, 0)), botao);
ui.set_prop(anim, "trigger", "hover")?;Fields§
§property: StringA propriedade do pai que a animação muda (opacity, fill, left…).
start_value: PropValueValor inicial; Null = o valor atual da propriedade.
stop_value: PropValueO valor a que a propriedade chega no fim da animação.
duration: f32Quanto dura a ida, em milissegundos.
delay: f32Espera antes de começar, em milissegundos (só na ida).
easing: EasingA curva de velocidade da animação (linear, out_quad…): como o valor anda no tempo.
trigger: TriggerO estado do pai que dispara a animação (hover, pressed, focused, checked,
appear); none: só por código.
auto_reverse: boolChegando ao fim, volta ao valor inicial pelo mesmo caminho.
looping: boolRepete sem parar até ser desligada.
enabled: boolDesligada, o gatilho não a dispara.
keyframes: StringSequência de passos (0:0; 0.6:1.15; 1:1: fração do tempo e valor), no lugar de ir de
start_value a stop_value (só números).
Implementations§
Source§impl PropertyAnimation
impl PropertyAnimation
Sourcepub fn float(property: &str, stop_value: f64) -> Self
pub fn float(property: &str, stop_value: f64) -> Self
FloatAnimation: anima uma propriedade numérica.
Sourcepub fn color(property: &str, stop_value: Color) -> Self
pub fn color(property: &str, stop_value: Color) -> Self
ColorAnimation: anima uma propriedade de cor.
pub fn with_trigger(self, trigger: Trigger) -> Self
pub fn with_duration(self, ms: f32) -> Self
pub fn with_easing(self, easing: Easing) -> Self
pub fn with_delay(self, ms: f32) -> Self
Trait Implementations§
Source§impl Clone for PropertyAnimation
impl Clone for PropertyAnimation
Source§impl Component for PropertyAnimation
impl Component for PropertyAnimation
Source§fn invoke(
&mut self,
ctx: &mut EventCtx<'_>,
method: &str,
_args: &[PropValue],
) -> Result<PropValue, String>
fn invoke( &mut self, ctx: &mut EventCtx<'_>, method: &str, _args: &[PropValue], ) -> Result<PropValue, String>
start (a de trigger: none, ou uma linha da lista pelo código) e stop (o valor fica
onde está), em todas as linguagens (pelo protocolo), como o Ui::start_animation.
Source§fn class_name(&self) -> &'static str
fn class_name(&self) -> &'static str
Source§fn props(&self) -> &'static [PropInfo]
fn props(&self) -> &'static [PropInfo]
inner) e as do
ControlBase são incluídas automaticamente pelo Ui.Source§fn get_prop(&self, name: &str) -> Option<PropValue>
fn get_prop(&self, name: &str) -> Option<PropValue>
None se não for dela.Source§fn set_prop(&mut self, name: &str, value: PropValue) -> Result<()>
fn set_prop(&mut self, name: &str, value: PropValue) -> Result<()>
Error::UnknownProperty se não for
dela (o Ui então tenta a camada base).Source§fn methods(&self) -> &'static [MethodInfo]
fn methods(&self) -> &'static [MethodInfo]
invoke atende, com os tipos (o catálogo do
acesso tipado nas linguagens: frmPaint.pcDesenho.Undo).Source§fn inner(&self) -> Option<&dyn Component>
fn inner(&self) -> Option<&dyn Component>
fn inner_mut(&mut self) -> Option<&mut dyn Component>
Source§fn class_chain(&self, out: &mut Vec<&'static str>)
fn class_chain(&self, out: &mut Vec<&'static str>)
GlowButton sem estilo próprio usa o estilo de Button.Source§fn control(&self) -> Option<&ControlBase>
fn control(&self) -> Option<&ControlBase>
None.fn control_mut(&mut self) -> Option<&mut ControlBase>
Source§fn default_event(&self) -> Option<&'static str>
fn default_event(&self) -> Option<&'static str>
None: a IDE escolhe pelo nome (o on_change da classe, o
on_timer… ou o on_click).Source§fn notification(&mut self, freed: ComponentId)
fn notification(&mut self, freed: ComponentId)
Notification(AComponent, opRemove)).
Quem guarda referências para outros componentes deve limpá-las aqui.Source§fn paint(&self, canvas: &mut dyn Canvas, ctx: &PaintCtx<'_>)
fn paint(&self, canvas: &mut dyn Canvas, ctx: &PaintCtx<'_>)
ctx.rect é a área dele.Source§fn transparent_background(&self) -> bool
fn transparent_background(&self) -> bool
fill
próprio, o Ui pinta o fundo dele inteiro. Os que têm
fundo usam o fill no desenho deles.Source§fn opaque(&self, style: &ResolvedStyle) -> bool
fn opaque(&self, style: &ResolvedStyle) -> bool
paint deste estilo cobre o retângulo inteiro do controle com cor opaca (um painel
de fundo sólido sem cantos arredondados, um form). Com true, o que fica inteiro atrás
dele (um irmão pintado antes) não é pintado: um medidor animando embaixo de uma tela que
o cobre não pede quadros. Na dúvida, false (o padrão): só se perde a economia.Source§fn clip_shape(&self) -> Option<ClipShape>
fn clip_shape(&self) -> Option<ClipShape>
None (o padrão): o retângulo, com o
raio do estilo no fundo.Source§fn paint_after(&self, canvas: &mut dyn Canvas, ctx: &PaintCtx<'_>)
fn paint_after(&self, canvas: &mut dyn Canvas, ctx: &PaintCtx<'_>)
Source§fn paint_is_pure(&self) -> bool
fn paint_is_pure(&self) -> bool
paint e paint_after) só lê: sem efeito colateral (nada de evento, de
cache que avança, de quadro de vídeo consumido) e o mesmo desenho para o mesmo estado,
estilo e propriedades. Com true, o Ui pode ensaiar o desenho fora do quadro e não
repintar o controle quando ele não mudou (o fundo de um contêiner quando o mouse entra
nele). Os contêineres simples dizem true; o padrão é false, mesmo com inner
(quem herda de um contêiner e pinta por cima precisa dizer de novo).Source§fn provided(&self) -> Option<Provided<'_>>
fn provided(&self) -> Option<Provided<'_>>
provider (veja crate::providers). O padrão: nada.Source§fn resized(&mut self, ctx: &mut EventCtx<'_>)
fn resized(&mut self, ctx: &mut EventCtx<'_>)
bounds) mudou depois de um layout (como o Resize).Source§fn click(&mut self, ctx: &mut EventCtx<'_>)
fn click(&mut self, ctx: &mut EventCtx<'_>)
Click). O padrão dispara o evento on_click.fn pointer_down(&mut self, ctx: &mut EventCtx<'_>, event: &PointerEvent)
fn pointer_up(&mut self, ctx: &mut EventCtx<'_>, event: &PointerEvent)
fn pointer_move(&mut self, ctx: &mut EventCtx<'_>, event: &PointerEvent)
fn pointer_enter(&mut self, ctx: &mut EventCtx<'_>)
fn pointer_leave(&mut self, ctx: &mut EventCtx<'_>)
fn wheel(&mut self, ctx: &mut EventCtx<'_>, event: &WheelEvent)
Source§fn gesture(&mut self, ctx: &mut EventCtx<'_>, event: &GestureEvent)
fn gesture(&mut self, ctx: &mut EventCtx<'_>, event: &GestureEvent)
ctx.set_handled()) para não subir
para os pais.Source§fn swipe(&mut self, ctx: &mut EventCtx<'_>, event: &SwipeEvent)
fn swipe(&mut self, ctx: &mut EventCtx<'_>, event: &SwipeEvent)
Carousel troca de item, o TabControl de página). Marque
como tratado (ctx.set_handled()) para não subir para os pais.Source§fn touch_end(&mut self, ctx: &mut EventCtx<'_>)
fn touch_end(&mut self, ctx: &mut EventCtx<'_>)
Source§fn edge_swipe(&mut self, ctx: &mut EventCtx<'_>, event: &SwipeEvent) -> bool
fn edge_swipe(&mut self, ctx: &mut EventCtx<'_>, event: &SwipeEvent) -> bool
event.start nas coordenadas do form) e que
ninguém tratou: a NavigationDrawer abre. true se tratou.Edit e do Memo: Recortar,
Copiar, Colar, Selecionar tudo). O Ui chama no botão direito e no toque longo
(touch), subindo do controle tocado pelos pais, só quando nem ele nem um pai tem
popup_menu (o menu do app vence). at é o ponto local. true se abriu um menu.fn key_down(&mut self, ctx: &mut EventCtx<'_>, event: &KeyEvent)
fn key_up(&mut self, ctx: &mut EventCtx<'_>, event: &KeyEvent)
Source§fn shortcut(&mut self, ctx: &mut EventCtx<'_>, event: &KeyEvent)
fn shortcut(&mut self, ctx: &mut EventCtx<'_>, event: &KeyEvent)
Ui
oferece a todos os componentes do form. Marque como tratado
(EventCtx::set_handled) se for sua.Source§fn platform_hooks(&self) -> Option<&dyn PlatformHooks>
fn platform_hooks(&self) -> Option<&dyn PlatformHooks>
Some(self) e implemente PlatformHooks.fn platform_hooks_mut(&mut self) -> Option<&mut dyn PlatformHooks>
Source§fn design_hooks(&self) -> Option<&dyn DesignHooks>
fn design_hooks(&self) -> Option<&dyn DesignHooks>
Some(self) e implemente DesignHooks.fn design_hooks_mut(&mut self) -> Option<&mut dyn DesignHooks>
Source§fn contains_point(&self, local: PointF, size: SizeF) -> bool
fn contains_point(&self, local: PointF, size: SizeF) -> bool
Source§fn hit_slop(&self) -> f32
fn hit_slop(&self) -> f32
contains_point (que recebe o ponto fora dele). Padrão: 0.Source§fn scroll_axes(&self) -> (bool, bool)
fn scroll_axes(&self) -> (bool, bool)
Ui::reveal
rola estes contêineres para mostrar um controle de dentro (o campo sob o teclado).Source§fn drag_drop(&self) -> Option<&dyn DragDrop>
fn drag_drop(&self) -> Option<&dyn DragDrop>
DragDrop). None (o padrão):
o componente não usa.fn drag_drop_mut(&mut self) -> Option<&mut dyn DragDrop>
fn accepts_text(&self) -> bool
Source§fn captures_key(&self, event: &KeyEvent) -> bool
fn captures_key(&self, event: &KeyEvent) -> bool
tab_keys).Source§fn mnemonic_text(&self) -> Option<&str>
fn mnemonic_text(&self) -> Option<&str>
& da letra do atalho ("&Salvar": Alt+S), para os controles que
aceitam (botões, caixas de marcar, rótulos, grupos).Source§fn mnemonic_focuses_child(&self) -> bool
fn mnemonic_focuses_child(&self) -> bool
Source§fn text_input(&mut self, ctx: &mut EventCtx<'_>, text: &str)
fn text_input(&mut self, ctx: &mut EventCtx<'_>, text: &str)
fn focus_enter(&mut self, ctx: &mut EventCtx<'_>)
fn focus_exit(&mut self, ctx: &mut EventCtx<'_>)
Source§fn property_changed(&mut self, ctx: &mut EventCtx<'_>, name: &str)
fn property_changed(&mut self, ctx: &mut EventCtx<'_>, name: &str)
Ui::set_prop: JSON,
Object Inspector, protocolo). É o lugar dos efeitos colaterais da mudança: aqui
o componente tem o Ui (por exemplo, o TabControl mostra a aba nova).Source§fn checked_state(&self) -> Option<bool>
fn checked_state(&self) -> Option<bool>
checked), lida pelo núcleo na pintura: o tema reflete a
marca mesmo quando o campo muda direto, sem o set_prop (C02 do Tabernáculo).Source§fn change_args(&self, name: &str, value: &PropValue) -> Option<EventArgs>
fn change_args(&self, name: &str, value: &PropValue) -> Option<EventArgs>
on_change quando a propriedade de valor name muda pelo código
(Ui::set_prop: o acesso tipado, o protocolo);
value é o valor novo. O padrão é EventArgs::Value(value): o controle que dispara
outro argumento quando o usuário muda (o texto do item, numa ComboBox) devolve o mesmo
aqui, e None não dispara. Quais propriedades contam: is_value_property.Source§fn paint_only_property(&self, name: &str) -> bool
fn paint_only_property(&self, name: &str) -> bool
name só muda a pintura (o valor de um medidor, o giro de um 3D): o
set_prop dela repinta sem refazer o layout da tela. As do controle (cores, opacidade,
giro, deslocamento, cursor, dica) o Ui já conhece; aqui vão as do componente. Na
dúvida, false (refazer o layout nunca está errado, só custa).Source§fn timed(&self) -> Option<&dyn Timed>
fn timed(&self) -> Option<&dyn Timed>
Timed). O padrão: o do componente de dentro.fn timed_mut(&mut self) -> Option<&mut dyn Timed>
Source§fn layout_hooks(&self) -> Option<&dyn LayoutHooks>
fn layout_hooks(&self) -> Option<&dyn LayoutHooks>
LayoutHooks). O padrão: o do componente de
dentro.Source§fn child_pointer_mut(&mut self) -> Option<&mut dyn ChildPointer>
fn child_pointer_mut(&mut self) -> Option<&mut dyn ChildPointer>
ChildPointer). O padrão: o do componente de
dentro.Source§fn popup(&self) -> Option<&dyn Popup>
fn popup(&self) -> Option<&dyn Popup>
Popup). O padrão: o do componente
de dentro.fn popup_mut(&mut self) -> Option<&mut dyn Popup>
Source§fn accessible_items(&self) -> Option<&dyn AccessibleItems>
fn accessible_items(&self) -> Option<&dyn AccessibleItems>
AccessibleItems). O padrão: o do
componente de dentro.fn accessible_items_mut(&mut self) -> Option<&mut dyn AccessibleItems>
Source§fn attach(&self) -> Option<(ComponentId, f32, f32)>
fn attach(&self) -> Option<(ComponentId, f32, f32)>
0..1 na largura e na altura: (1, 0) é o canto de
cima à direita). É o que deixa um Badge no canto de um botão.