Welcome Screen: Initial Layout

This commit is contained in:
Stef Tervelde
2025-02-07 15:49:25 +01:00
parent bd3a77ef17
commit 5c020dd017
12 changed files with 304 additions and 29 deletions
@@ -0,0 +1,7 @@
<svg width="120" height="164" viewBox="0 0 120 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M-22 146C19.1706 112.211 52.4455 72.5963 97 19" stroke="#1F34AB" stroke-width="58"/>
<circle cx="75.5" cy="23.5" r="10.5" fill="white"/>
<circle cx="96.5" cy="42.5" r="10.5" fill="white"/>
<circle cx="76" cy="19" r="3" fill="#222222"/>
<circle cx="97" cy="37" r="3" fill="#222222"/>
</svg>

After

Width:  |  Height:  |  Size: 418 B

@@ -0,0 +1,17 @@
<svg width="101" height="128" viewBox="0 0 101 128" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_f_2007_98)">
<ellipse cx="57" cy="116.5" rx="18" ry="3.5" fill="#0F195A" fill-opacity="0.4"/>
</g>
<path d="M21 21L80 80" stroke="#82AFFF" stroke-width="58"/>
<circle cx="85.5681" cy="66.9495" r="10.5" transform="rotate(121.241 85.5681 66.9495)" fill="white"/>
<circle cx="58.4319" cy="75.0504" r="10.5" transform="rotate(121.241 58.4319 75.0504)" fill="white"/>
<circle cx="89.1563" cy="69.711" r="3" transform="rotate(121.241 89.1563 69.711)" fill="#222222"/>
<circle cx="62.875" cy="78.3304" r="3" transform="rotate(121.241 62.875 78.3304)" fill="#222222"/>
<defs>
<filter id="filter0_f_2007_98" x="31" y="105" width="52" height="23" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="4" result="effect1_foregroundBlur_2007_98"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+141 -3
View File
@@ -1,11 +1,27 @@
package processing.app.ui
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.MaterialTheme.colors
import androidx.compose.material.MaterialTheme.typography
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import processing.app.Base
import processing.app.ui.theme.LocalLocale
import processing.app.ui.theme.PDEButton
import processing.app.ui.theme.PDEWindow
import processing.app.ui.theme.pdeapplication
import java.io.IOException
@@ -22,7 +38,129 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
companion object {
@Composable
fun welcome() {
Box(modifier = Modifier.sizeIn(815.dp, 450.dp)){
Row(
modifier = Modifier
// .background(
// Brush.linearGradient(
// colorStops = arrayOf(0.0f to Color.Transparent, 1f to Color.Blue),
// start = Offset(815f / 2, 0f),
// end = Offset(815f, 450f)
// )
// )
.size(815.dp, 450.dp)
.padding(32.dp)
,
horizontalArrangement = Arrangement.spacedBy(32.dp)
){
Box(modifier = Modifier
.weight(1f)
.fillMaxHeight()
){
intro()
}
Column(modifier = Modifier
.weight(1.25f)
.fillMaxHeight(),
verticalArrangement = Arrangement.SpaceBetween
){
examples()
val locale = LocalLocale.current
Column(
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
Text(
text = locale["welcome.action.examples"],
)
Text(
text = locale["welcome.action.tutorials"],
)
}
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
){
Text(
text = locale["welcome.action.startup"],
)
PDEButton(onClick = { println("Open") }) {
val locale = LocalLocale.current
Text(locale["welcome.action.go"])
}
}
}
}
}
@Composable
fun intro(){
val locale = LocalLocale.current
Column(
modifier = Modifier
.fillMaxHeight(),
verticalArrangement = Arrangement.SpaceBetween) {
Column {
Text(
text = locale["welcome.intro.title"],
style = typography.h4,
)
Text(
text = locale["welcome.intro.message"],
style = typography.body1,
)
}
Column {
Text(
text = locale["welcome.intro.suggestion"],
style = typography.body1,
modifier = Modifier
.padding(vertical = 16.dp)
.clip(RoundedCornerShape(12.dp))
.background(colors.primary)
.padding(16.dp)
.sizeIn(maxWidth = 200.dp)
)
Row(
modifier = Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Image(
painter = painterResource("welcome/intro/long.svg"),
contentDescription = locale["welcome.intro.long"],
modifier = Modifier
.offset(x = -32.dp)
)
Image(
painter = painterResource("welcome/intro/short.svg"),
contentDescription = locale["welcome.intro.short"],
modifier = Modifier
.align(Alignment.Bottom)
)
}
}
}
}
@Composable
fun examples(){
LazyVerticalGrid(
columns = GridCells.Fixed(2),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
){
items(4){
Column {
Box(
modifier = Modifier
.background(colors.primary)
.width(185.dp)
.aspectRatio(16f / 9f)
)
Text("Example $it")
}
}
}
}
+2 -15
View File
@@ -103,21 +103,8 @@ class WelcomeToBeta {
@JvmStatic
fun main(args: Array<String>) {
application {
val windowState = rememberWindowState(
size = DpSize.Unspecified,
position = WindowPosition(Alignment.Center)
)
Window(onCloseRequest = ::exitApplication, state = windowState, title = Locale()["beta.window.title"]) {
ProcessingTheme {
Surface(color = colors.background) {
welcomeToBeta {
exitApplication()
}
}
}
}
pdeapplication("beta.window.title") {
welcomeToBeta()
}
}
}
+34 -11
View File
@@ -2,6 +2,8 @@ package processing.app.ui.theme
import androidx.compose.material.MaterialTheme.typography
import androidx.compose.material.Typography
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.ExperimentalTextApi
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
@@ -21,18 +23,39 @@ val processingFont = FontFamily(
style = FontStyle.Normal
)
)
val spaceGroteskFont = FontFamily(
Font(
resource = "SpaceGrotesk-Bold.ttf",
weight = FontWeight.Bold,
),
Font(
resource = "SpaceGrotesk-Regular.ttf",
weight = FontWeight.Normal,
),
Font(
resource = "SpaceGrotesk-Medium.ttf",
weight = FontWeight.Medium,
),
Font(
resource = "SpaceGrotesk-SemiBold.ttf",
weight = FontWeight.SemiBold,
),
Font(
resource = "SpaceGrotesk-Light.ttf",
weight = FontWeight.Light,
)
)
val Typography = Typography(
body1 = TextStyle(
fontFamily = processingFont,
fontWeight = FontWeight.Normal,
fontSize = 13.sp,
lineHeight = 16.sp
),
subtitle1 = TextStyle(
fontFamily = processingFont,
defaultFontFamily = spaceGroteskFont,
h4 = TextStyle(
fontWeight = FontWeight.Bold,
fontSize = 16.sp,
lineHeight = 20.sp
)
fontSize = 19.sp,
lineHeight = 24.sp
),
body1 = TextStyle(
fontWeight = FontWeight.Normal,
fontSize = 15.sp,
lineHeight = 19.sp
),
)
Binary file not shown.
@@ -0,0 +1,93 @@
Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
View File
@@ -614,6 +614,16 @@ update_check.updates_available.core = A new version of Processing is available,\
update_check.updates_available.contributions = There are updates available for some of the installed contributions,\nwould you like to open the the Contribution Manager now?
# ---------------------------------------
# Welcome
welcome.intro.title = Welcome to Processing
welcome.intro.message = A flexible software sketchbook and a language for learning how to code.
welcome.intro.suggestion = Is it your first time using Processing? Try one of the examples on the right.
welcome.action.examples = More examples
welcome.action.tutorials = Tutorials
welcome.action.startup = Startup
welcome.action.go = "Let's go!"
# ---------------------------------------
# Beta
beta.window.title = Welcome to Beta