This file contains hidden or 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
-- circle lib | |
require("mathlib") | |
display.setDefault( "isAnchorClamped", false ) | |
local min, max = -10000000000000, 10000000000000 | |
local cache = {} | |
local circlelib = {} |
This file contains hidden or 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
local widget = require("widget") | |
local function angleOf( ax, ay, bx, by, adjust, positive ) | |
local angle = math.atan2( by-ay, bx-ax ) * 180/math.pi | |
if (adjust) then | |
if (type(adjust) ~= "number") then adjust = -90 end | |
angle = angle - adjust | |
if (angle < -180) then angle=angle+360 end | |
if (angle > 180) then angle=angle-360 end |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
local M = {} | |
local wordz = {} | |
wordz[1] = nil | |
wordz[2] = { 'aa','ab','ad','ae','ag','ah','ai','al','am','an','ar','as','at','aw','ax','ay','ba','be','bi','bo','by','de','do','ed','ef','eh','el','em','en','er','es','et','ex','fa','go','ha','he','hi','hm','ho','id','if','in','is','it','jo','ka','la','li','lo','ma','me','mi','mm','mo','mu','my','na','ne','no','nu','od','oe','of','oh','om','on','op','or','os','ow','ox','oy','pa','pe','pi','re','sh','si','so','ta','ti','to','uh','um','un','up','us','ut','we','wo','xi','xu','ya','ye','yo' } | |
wordz[3] = { 'aah','aal','aas','aba','abo','abs','aby','ace','act','add','ado','ads','adz','aff','aft','aga','age','ago','aha','aid','ail','aim','ain','air','ais','ait','ala','alb','ale','all','alp','als','alt','ama','ami','amp','amu','ana','and','ane','ani','ant','any','ape','apt','arb','arc','are','arf','ark','arm','ars','art','ash','ask','asp','ass','ate','att','auk','ava','ave','avo','awa','awe','awl','awn','axe','aye','ays','azo','baa','bad','bag','bah',' |
This file contains hidden or 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
function TransitionColor(displayObj, params) | |
if(params and params.startColor and params.endColor) then | |
local length = params.time or 300 | |
local startTime = system.getTimer() | |
local easingFunc = params.transition or easing.linear | |
local function colorInterpolate(a,b,i,t) | |
colourTable = { | |
easingFunc(i,t,a[1],b[1]-a[1]), |
This file contains hidden or 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
local function makeGenerator() | |
local kernel = { | |
category = "generator", | |
name = "stars", | |
isTimeDependent = false | |
} | |
kernel.vertexData = { | |
{ |
This file contains hidden or 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
local function angleOnTarget( e ) | |
local a = math.atan2( e.y-e.target.y, e.x-e.target.x ) * 180 / (4*math.atan(1)) | |
if (a<0) then a=a+360 end | |
return a | |
end | |
local function tap(e) | |
e.target.touchMode = "drag" | |
print("drag mode") | |
e.target.dragtimer = timer.performWithDelay( 400, function() |
This file contains hidden or 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
-- ref: http://docs.coronalabs.com/daily/guide/graphics/effects.html#generator.radialgradient | |
local back, outer, inner = {0,1,0,1}, {0,.9,0,.05}, {0,1,0,.05} | |
-- backing colour rect | |
display.newRect( display.actualCenterX*.5, display.actualContentHeight*.25, 220, 220 ).fill = back | |
-- radial fill rect | |
local r = display.newRect( display.actualCenterX*.5, display.actualContentHeight*.25, 200, 200 ) | |
local function getRadius( r, xOffset, yOffset ) |
This file contains hidden or 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
local function shadow( width, height, size ) | |
local g = display.newGroup() | |
g.x, g.y = display.contentCenterX, display.contentCenterY | |
display.newRect( g, 0, 0, width+size, height+size ).fill = {1,1,1,0} | |
display.newRect( g, 0, 0, width, height ).fill = {0,0,0} | |
local c = display.capture( g ) | |
g = display.remove( g ) | |
This file contains hidden or 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
display.setDefault("background", 0.2, 0.2, 0.4 ) | |
-- Keep track of time in seconds | |
local secondsLeft = 20 * 60 -- 20 minutes * 60 seconds | |
local clockText = display.newText("20:00", display.contentCenterX, 80, native.systemFontBold, 80) | |
clockText:setFillColor( 0.7, 0.7, 1 ) | |
local function updateTime() | |
-- decrement the number of seconds |
This file contains hidden or 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
-- polygon concave test | |
require("mathlib") | |
stage = display.getCurrentStage() | |
local text = display.newText{ text="- - -", x=display.contentCenterX, y=100, fontSize=24 } | |
lines = display.newGroup() | |
lines:insert(display.newGroup()) |