Skip to content

Instantly share code, notes, and snippets.

View Volorf's full-sized avatar
👽

Oleg Frolov Volorf

👽
View GitHub Profile
@Volorf
Volorf / AppleLogoWIthRgbOffset.swift
Created February 16, 2025 18:04
Apple Logo With RGB Offset
import SwiftUI
import CoreMotion
// Main View
struct AppleLogoWithRgbOffset: View {
// Initiate and pass a motion manager instance as
// an enviromental dependency when you initilize this view
@EnvironmentObject var motion: MotionManager
@Volorf
Volorf / BoxelStructure.cs
Last active January 28, 2025 21:32
Boxel Data Structure
// An object that is serialized and saved as a sketchInfo.json in a sketch folder
[Serializable]
public class SketchInfo
{
public string sketchName;
public string dateCreated;
public string sketchID;
public Vector3 parentPosition; // Position of the container where boxels live.
public Quaternion parentRotation; // Rotation of the container where boxels live.
public string appVersion;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Planet : MonoBehaviour
{
[SerializeField] List<Color> colors;
[SerializeField] MeshRenderer meshRenderer;
[SerializeField] Vector2 scaleRange;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
public class PlanetSpawner : MonoBehaviour
{
[SerializeField] List<GameObject> planets;
[SerializeField] Vector3 spawnVolume;
@Volorf
Volorf / TextAnimation.swift
Last active March 22, 2024 11:46
Text Animation.swift
import SwiftUI
import PlaygroundSupport
struct MyExperimentalView: View
{
@State private var count: Int = 10
var body: some View
{
Text("Count: \(count)")
@Volorf
Volorf / Remap.cs
Last active January 7, 2024 19:41
Remap extension method for Float Value
using UnityEngine;
public static class ExtensionMethods
{
public static float Remap (this float from, float fromMin, float fromMax, float toMin, float toMax)
{
float fromAbs = from - fromMin;
float fromMaxAbs = fromMax - fromMin;
float normal = fromAbs / fromMaxAbs;
float toMaxAbs = toMax - toMin;
namespace ExtensionMethods
{
public static class MyExtensions
{
public static void Next(this ref MyEnum item)
{
int count = Enum.GetNames(typeof(MyEnum)).Length;
int index = item.GetHashCode();
int nextIndex = index + 1;
if (nextIndex >= count) nextIndex = 0;
using UnityEngine;
using UnityEngine.UI;
public class ToggleColorManager : MonoBehaviour
{
[Header("Elements")]
public Toggle toggle;
public Image icon;
[Space(16)]
Number(thisComp.layer("CounterController").effect("Slider Control")("Slider")).toFixed(1)
// 2.0
@Volorf
Volorf / UnityCheapSheet.cs
Last active October 23, 2021 20:25
Unity Cheap Sheet
// Vectors
Debug.Log(Vector3.forward); // (0, 0, 1.0)
Debug.Log(Vector3.right); // (1.0, 0, 0)
Debug.Log(Vector3.up); // (0, 1.0, 0)
// Rotation toward a direction
// https://answers.unity.com/questions/803365/make-the-player-face-his-movement-direction.html
float moveHorizontal = Input.GetAxisRaw ("Horizontal");
float moveVertical = Input.GetAxisRaw ("Vertical");