Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hover effect to weather and error icons #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions UnityProjekte/Base Project/Assets/Scripts/HoverAnimation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HoverAnimation : MonoBehaviour
{
public float amplitude = 2f;
public float speed = 0.5f;
Comment on lines +7 to +8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable values instead of hard coded would be more flexible, but the given values should do the job


private void Update()
{
Vector3 p = transform.position;
p.y = amplitude * Mathf.Cos(Time.time * speed);
transform.position = p;
Comment on lines +12 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idea should work, simple mathematics, using the cos is a good idea! 👍
(for better extensibility and readability you can put the code in a new function)

}
}
11 changes: 11 additions & 0 deletions UnityProjekte/Base Project/Assets/Scripts/HoverAnimation.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.