Skip to content

Instantly share code, notes, and snippets.

View birdsigh's full-sized avatar

Tim Crook birdsigh

View GitHub Profile
<?php
use craft\elements\Entry;
return [
'endpoints' => [
'search.json' => function() {
// settings
$section_handle = 'articles';
$phrase = Craft::$app->request->getParam('query');
anonymous
anonymous / gist:10675250
Created April 14, 2014 19:11
Motion Blur + Chromatic Aberration
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
Shader "Sprites/Cutout"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.5
}
@winkels
winkels / TimeScaleIndependentParticleSystem.cs
Last active March 25, 2018 10:46
Unity script that allows for particle motion while Time.timeScale = 0. See http://www.asteroidbase.com/?p=569 for context.
using UnityEngine;
using System.Collections;
public class TimeScaleIndependentParticleSystem : TimeScaleIndependentUpdate
{
protected override void Update()
{
base.Update();
particleSystem.Simulate(deltaTime, true, false);
@winkels
winkels / TimeScaleIndependentAnimation.cs
Last active March 25, 2018 10:45
Unity script that allows for animation while Time.timeScale = 0. See http://www.asteroidbase.com/?p=569 for context.
using UnityEngine;
using System.Collections;
public class TimeScaleIndependentAnimation : TimeScaleIndependentUpdate
{
//inspector fields
public bool playOnStart;
public string playOnStartStateName;
//private fields
@winkels
winkels / TimeScaleIndependentUpdate.cs
Last active December 21, 2022 12:10
Unity script that allows for updates while Time.timeScale = 0. See http://www.asteroidbase.com/?p=569 for context.
using UnityEngine;
using System.Collections;
public class TimeScaleIndependentUpdate : MonoBehaviour
{
//inspector fields
public bool pauseWhenGameIsPaused = true;
//private fields
float previousTimeSinceStartup;
/*
Tween for Unity by Alec Holowka
http://InfiniteAmmo.com - @infinite_ammo
*/
using UnityEngine;
using System.Collections;
public class TweenBase : MonoBehaviour
{
/*
InputX for Unity by Alec Holowka
WARNING: Work-in-progress!
http://InfiniteAmmo.com - @infinite_ammo
*/
/*
Note: use this code in an editor script to initialize the InputManager asset for use by InputX
[MenuItem("X/Setup InputManager Asset")]
@cubed2d
cubed2d / gist:5217832
Last active December 15, 2015 06:39
Example of how i draw the awesome Array/List inspectors in the swindle
public override void OnInspectorGUI2()
{
// First off, cache a copy of target cast to its type, makes like easier. EXAMPLE
AmbientLight light = target as AmbientLight;
// This is to top area of the inspector GUI. draw controls here for making chages to parts of the target object that arnt part of the array.
light.timeOfDay = EditorGUILayout.Slider("Time of Day", light.timeOfDay, 0, 24);
// leave some space to split the main settings from the array
EditorGUILayout.Space();
// attach this to a camera. It sets the sort mode so 2D object are rendered correctly with a perspective camera.
public class CameraSortModeSetter : MonoBehaviour
{
void Update()
{
if (camera != null && camera.transparencySortMode != TransparencySortMode.Orthographic)
camera.transparencySortMode = TransparencySortMode.Orthographic;
}
}