This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 image + 1 audio = video | |
ffmpeg -loop 1 -i image.jpg -i audio.wav -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int RandomWeighted(List<int> weights) | |
{ | |
int accumulatedWeigts = 0; | |
for (int i = 0; i < weights.Count; i++) | |
{ | |
accumulatedWeigts += weights[i]; | |
weights[i] = accumulatedWeigts; | |
} | |
//If accumulated weights is 0, choose random index. Otherwise, logic would always select 1st element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int pIdx = 0; pIdx < points.Count - 1; pIdx++) | |
{ | |
RectTransform point1 = points[pIdx]; | |
RectTransform point2 = points[pIdx + 1]; | |
Vector2 midpoint = (point2.position - point1.position) / 2 + point1.position; | |
float xDifference = point2.position.x - point1.position.x; | |
float yDifference = point2.position.y - point1.position.y; | |
float distance = (point2.position - point1.position).magnitude; | |
float angle = Mathf.Acos(Mathf.Abs(xDifference)/ distance) * 57.2958f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
using System; | |
using System.Collections.Generic; | |
[RequireComponent(typeof(RectTransform))] | |
public class CurvedText : BaseMeshEffect | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections.Generic; | |
public abstract class ListComponent<T> : MonoBehaviour where T : MonoBehaviour | |
{ | |
public static List<T> InstanceList = new List<T>(); | |
protected virtual void OnEnable() | |
{ | |
InstanceList.Add( this as T ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public abstract class SingletonComponent<T> : SingletonComponent where T : MonoBehaviour | |
{ | |
public static T Instance | |
{ | |
get { return instance; } | |
} | |
private static T instance = default( T ); |