mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Replace logo-triangles.mp4 with shadered logo-triangles.png
This commit is contained in:
parent
f381cf3ae8
commit
68f078c9e6
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -12,7 +11,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Graphics.Video;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
@ -88,7 +86,7 @@ namespace osu.Game.Screens.Menu
|
||||
private RulesetFlow rulesets;
|
||||
private Container rulesetsScale;
|
||||
private Container logoContainerSecondary;
|
||||
private Drawable lazerLogo;
|
||||
private LazerLogo lazerLogo;
|
||||
|
||||
private GlitchingTriangles triangles;
|
||||
|
||||
@ -139,10 +137,10 @@ namespace osu.Game.Screens.Menu
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Child = lazerLogo = new LazerLogo(textures.GetStream("Menu/logo-triangles.mp4"))
|
||||
Child = lazerLogo = new LazerLogo()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -218,6 +216,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
// matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5
|
||||
lazerLogo.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint);
|
||||
lazerLogo.Start(logo_1, logo_scale_duration);
|
||||
logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad);
|
||||
}
|
||||
|
||||
|
109
osu.Game/Screens/Menu/LazerLogo.cs
Normal file
109
osu.Game/Screens/Menu/LazerLogo.cs
Normal file
@ -0,0 +1,109 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Shaders;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.MathUtils;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class LazerLogo : Drawable
|
||||
{
|
||||
private IShader shader;
|
||||
private Texture texture;
|
||||
|
||||
private double startTime = -1000;
|
||||
private double animationTime = -1000;
|
||||
|
||||
private float animation;
|
||||
private float highlight;
|
||||
|
||||
public LazerLogo()
|
||||
{
|
||||
Size = new Vector2(960);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders, TextureStore textures)
|
||||
{
|
||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LazerLogo");
|
||||
texture = textures.Get("Menu/logo-triangles.png");
|
||||
}
|
||||
|
||||
public void Start(double delay, double duration)
|
||||
{
|
||||
startTime = Clock.CurrentTime + delay;
|
||||
animationTime = duration;
|
||||
}
|
||||
|
||||
public override bool IsPresent => true;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (animationTime < 0) return;
|
||||
|
||||
highlight = Clock.CurrentTime < startTime + 0.4 * animationTime
|
||||
? Interpolation.ValueAt(Clock.CurrentTime, 0f, 1f, startTime, startTime + animationTime * 1.07, Easing.OutCirc)
|
||||
: Interpolation.ValueAt(Clock.CurrentTime, 0.6f, 1f, startTime, startTime + animationTime * 0.9);
|
||||
|
||||
animation = Clock.CurrentTime < startTime + 0.5 * animationTime
|
||||
? Interpolation.ValueAt(Clock.CurrentTime, 0f, 0.8f, startTime, startTime + animationTime * 1.23, Easing.OutQuart)
|
||||
: Interpolation.ValueAt(Clock.CurrentTime, 0.4f, 1f, startTime, startTime + animationTime);
|
||||
}
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new LazerLogoDrawNode(this);
|
||||
|
||||
private class LazerLogoDrawNode : DrawNode
|
||||
{
|
||||
protected new LazerLogo Source => (LazerLogo)base.Source;
|
||||
|
||||
private IShader shader;
|
||||
private Texture texture;
|
||||
private Quad screenSpaceDrawQuad;
|
||||
private float animation;
|
||||
private float highlight;
|
||||
|
||||
public LazerLogoDrawNode(LazerLogo source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ApplyState()
|
||||
{
|
||||
base.ApplyState();
|
||||
|
||||
shader = Source.shader;
|
||||
texture = Source.texture;
|
||||
screenSpaceDrawQuad = Source.ScreenSpaceDrawQuad;
|
||||
animation = Source.animation;
|
||||
highlight = Source.highlight;
|
||||
}
|
||||
|
||||
protected virtual void Blit(Action<TexturedVertex2D> vertexAction)
|
||||
{
|
||||
DrawQuad(texture, screenSpaceDrawQuad, DrawColourInfo.Colour, null, vertexAction);
|
||||
}
|
||||
|
||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||
{
|
||||
base.Draw(vertexAction);
|
||||
|
||||
shader.Bind();
|
||||
shader.GetUniform<float>("highlight").Value = highlight;
|
||||
shader.GetUniform<float>("animation").Value = animation;
|
||||
|
||||
Blit(vertexAction);
|
||||
|
||||
shader.Unbind();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user