Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
generative_art_cartoon
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Finn Bear
generative_art_cartoon
Commits
4f8e64fc
Commit
4f8e64fc
authored
2 years ago
by
Finn Bear
Browse files
Options
Downloads
Patches
Plain Diff
Fade in title.
parent
326ac405
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/color.rs
+3
-0
3 additions, 0 deletions
src/color.rs
src/slide/s1_title.rs
+47
-11
47 additions, 11 deletions
src/slide/s1_title.rs
with
50 additions
and
11 deletions
src/color.rs
+
3
−
0
View file @
4f8e64fc
...
...
@@ -47,6 +47,9 @@ pub fn set_style_alpha_in_place(style: &mut Style, factor: f32) {
]
{
set_widget_alpha_in_place
(
widget
,
factor
);
}
if
let
Some
(
override_text_color
)
=
style
.visuals.override_text_color
.as_mut
()
{
set_alpha_in_place
(
override_text_color
,
factor
);
}
set_alpha_in_place
(
&
mut
style
.visuals.hyperlink_color
,
factor
);
set_alpha_in_place
(
&
mut
style
.visuals.faint_bg_color
,
factor
);
set_alpha_in_place
(
&
mut
style
.visuals.extreme_bg_color
,
factor
);
...
...
This diff is collapsed.
Click to expand it.
src/slide/s1_title.rs
+
47
−
11
View file @
4f8e64fc
use
crate
::
egui
::
Align2
;
use
crate
::
egui
::{
Align2
,
Context
};
use
crate
::
fade_in
::
fade_in
;
use
crate
::
slide
::
Slide
;
use
crate
::{
ctx_img
,
Margin
};
use
eframe
::
egui
::{
Frame
,
TextureHandle
,
Ui
,
Vec2
,
Window
};
...
...
@@ -7,9 +8,32 @@ use eframe::egui::{Frame, TextureHandle, Ui, Vec2, Window};
#[derive(Default)]
pub
struct
Title
{
examples
:
Vec
<
TextureHandle
>
,
state
:
TitleState
,
}
#[derive(Default)]
enum
TitleState
{
#[default]
Initial
,
Title
{
// When we started fading in the title.
fade_start
:
f64
,
},
}
impl
Slide
for
Title
{
fn
transition
(
&
mut
self
,
ctx
:
&
Context
)
->
bool
{
match
&
self
.state
{
TitleState
::
Initial
=>
{
self
.state
=
TitleState
::
Title
{
fade_start
:
ctx
.input
()
.time
,
}
}
TitleState
::
Title
{
..
}
=>
return
true
,
}
false
}
fn
show
(
&
mut
self
,
ui
:
&
mut
Ui
)
{
if
self
.examples
.is_empty
()
{
// For now, these images are somewhat like placeholders.
...
...
@@ -33,17 +57,29 @@ impl Slide for Title {
});
}
Window
::
new
(
"title"
)
.title_bar
(
false
)
.resizable
(
false
)
.anchor
(
Align2
::
CENTER_CENTER
,
Vec2
::
ZERO
)
.default_width
(
400.0
)
.frame
(
Frame
::
window
(
ui
.style
()))
.show
(
ui
.ctx
(),
|
ui
|
{
ui
.vertical_centered
(|
ui
|
{
ui
.heading
(
"Generative Art"
);
ui
.label
(
"By: Finn, Matthew, Nathan, Owen"
);
if
let
&
TitleState
::
Title
{
fade_start
}
=
&
self
.state
{
fade_in
(
ui
,
fade_start
,
|
ui
|
{
ui
.scope
(|
ui
|
{
// Extra large margins for title window.
ui
.style_mut
()
.spacing.window_margin
=
Margin
::
same
(
20.0
);
Window
::
new
(
"title"
)
.title_bar
(
false
)
.resizable
(
false
)
.anchor
(
Align2
::
CENTER_CENTER
,
Vec2
::
ZERO
)
.default_width
(
400.0
)
.frame
(
Frame
::
window
(
ui
.style
()))
.show
(
ui
.ctx
(),
|
ui
|
{
// Nested fade since fade doesn't propagate through window.
fade_in
(
ui
,
fade_start
,
|
ui
|
{
ui
.vertical_centered
(|
ui
|
{
ui
.heading
(
"Generative Art"
);
ui
.label
(
"By: Finn, Matthew, Nathan, Owen"
);
});
});
});
});
});
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment