View dragitemscrollview.lua
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
View simple drag and rotate demo.lua
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()
View circlelib.lua
-- circle lib
require("mathlib")
display.setDefault( "isAnchorClamped", false )
local min, max = -10000000000000, 10000000000000
local cache = {}
local circlelib = {}
View shadow.lua
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 )
View flood.lua
-- 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 )
View debugconsole.lua
-- debug console
local widget = require("widget")
local lib = {}
local originalPrintFunc = print
local debugPrintFunc = nil
local showingDebugConsole = false
View backswipelib.lua
-- swipe library
--[[ Libraries ]]--
local composer = require("composer")
--[[ Fields ]]--
local mainstage = display.getCurrentStage()
local stage = composer.stage
View iolib.lua
-- io operations
local json = require("json")
local lfs = require( "lfs" )
local iolib = {}
--[[ FACILITIES ]]--
local function toDate( timestamp )
View rgb.lua
-- rgb
-- Colors referenced from http://www.tayloredmktg.com/rgb/
local RGB = {
neoncyan = {16, 174, 239}, -- Neon Cyan
neonyellow = {231, 228, 37}, -- Neon Yellow
neonpink = {231, 83, 177}, -- Neon Pink
neongreen = {4, 228, 37}, -- Neon Green
View arrowlib.lua
-- arrow test
-- http://www.iforce2d.net/b2dtut/sticky-projectiles
-- video: http://screencast.com/t/vcPLSJR6xkIq
require("mathlib")
local sWidth, sHeight = display.actualContentWidth, display.actualContentHeight
local centerX, centerY = sWidth/2, sHeight/2