Skip to content

Instantly share code, notes, and snippets.

@Utsira
Utsira / DisintegrationShader.lua
Last active May 2, 2019 20:23
Disintegration Shader
--# Main
-- Disintegration Shader
supportedOrientations(LANDSCAPE_ANY)
function setup()
-- parameter.watch("grav")
-- parameter.watch("gravBack") --for bug-checking the get local point function
print ("tilt to spin the sphere \ntap the screen to explode / unexplode the mesh")
aerial = color(28, 27, 54, 255)
verts = Isosphere(5)
@Utsira
Utsira / Component system
Last active April 15, 2016 14:30
Component System using Mix-ins for Codea / Lua
--# Main
-- Component System by Utsira. uses runtime mix-ins to add component's methods to entities (ie not a pure entity - component - system model).
-- TO USE:
-- Entity is a superclass that adds the method :add, for adding (including) components to game objects(entities).
-- Components are tables, but use : to name their methods.
-- If component has an iterator table then it is a system. Iterate will run through every entity that is part of that system
-- If component has an :init function, this will not be added to the entity, but will instead be run when the component is added
-- Use this function to perform your initial setup
function setup()
@Utsira
Utsira / Squash and stretch
Last active August 29, 2015 14:17
Squash and stretch
--# Main
-- Sandbox
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN_NO_BUTTONS)
--displayMode(OVERLAY)
--displayMode(FULLSCREEN)
function setup()
screen=vec2(WIDTH,HEIGHT)
--# Main
--3D Model viewer
State={Ready=1,Loading=2,Error=3}
function setup()
parameter.integer("Choose",1,#Models,3)
parameter.action("Load",ShowModel)
parameter.integer("Zoom",1,300,50)
parameter.boolean("AutoRotate",true)