Skip to content

Instantly share code, notes, and snippets.

@phi16
phi16 / Wire.shader
Last active January 21, 2024 15:32
Wire
Shader "phi16/Wire"
{
Properties
{
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
ZWrite Off
@phi16
phi16 / AnimationLooper.cs
Last active January 11, 2024 09:56
Make a loop animation from non-loop (but nearly looping) animation
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class AnimationLooper : MonoBehaviour {
[SerializeField] private AnimationClip clip;
[SerializeField] private float overlapTime = 0.5f;
[SerializeField] private string path;
#if UNITY_EDITOR
@phi16
phi16 / AnimCurve.cs
Last active December 26, 2022 16:36
using UnityEngine;
using MathNet.Numerics;
using System;
using System.Collections.Generic;
class AnimCurve {
public enum CurveType {
Discrete,
Linear,
Smooth,
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
#if UNITY_EDITOR
using UnityEditor;
#endif
// Original: https://styly.cc/ja/tips/aigaalince001_jojomon_particlelive1/ CreateBoneAnimeClip.cs
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using System;
#if UNITY_EDITOR
using UnityEditor;
// Original: https://techblog.sega.jp/entry/2016/11/28/100000
public class KeyframeReduction : AssetPostprocessor
@phi16
phi16 / MeshGenerator.cs
Last active August 1, 2020 07:40
don't use this without rewriting the `path`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Events;
using UnityEditor.Animations;
#endif
public class MeshGenerator : MonoBehaviour {
@phi16
phi16 / Air.shader
Created August 1, 2020 07:36
original
Shader "Amebient/Air"
{
Properties
{
_Color ("Color", Color) = (0.5,0.8,1,1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent-525" "LightMode"="ForwardBase" "DisableBatching"="True" }
LOD 100
Shader "Mochi/Snow"
{
Properties
{
_Color ("Color", Color) = (0.5,0.8,1,1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "LightMode"="ForwardBase" "DisableBatching"="True" }
LOD 100
@phi16
phi16 / qr.js
Created December 10, 2017 07:39
// dokka kara totte kita
function dataURItoBlob(dataURI) {
// convert base64/URLEncoded data component to raw binary data held in a string
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]);
else
byteString = unescape(dataURI.split(',')[1]);
// separate out the mime component
@phi16
phi16 / index.html
Created November 12, 2016 03:30
Canvas putImageData
<!DOCTYPE html>
<head>
<title>test</title>
<script type="text/javascript">
var cvs2,ctx2;
var cvs,ctx;
var cnt = 0;
function render(){
ctx.fillStyle = "rgb(255,255,255)";